Skip to content

Adds slash to beginning of JS files injected but not CSS files #930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pixelpaulaus opened this issue Apr 19, 2018 · 2 comments
Closed

Adds slash to beginning of JS files injected but not CSS files #930

pixelpaulaus opened this issue Apr 19, 2018 · 2 comments
Labels

Comments

@pixelpaulaus
Copy link

pixelpaulaus commented Apr 19, 2018

is anyone else noticing that all CSS files injected have no / at the beginning while all js files have a / added to the beginning?
It is playing havoc with me as i can specify a public path for both.

example... if i set the public path to files/

the CSS will end up being files/cssfile.css
but the JS will end up being files//jsfile.js

@jantimon
Copy link
Owner

Could you please add some console.log or debugger statements in your node_modules/html-webpack-plugin/index.js file?

The public path is prepared here:

htmlWebpackPluginAssets (compilation, chunks) {
const self = this;
const compilationHash = compilation.hash;
// Use the configured public path or build a relative path
let publicPath = typeof compilation.options.output.publicPath !== 'undefined'
// If a hard coded public path exists use it
? compilation.mainTemplate.getPublicPath({hash: compilationHash})
// If no public path was set get a relative url path
: path.relative(path.resolve(compilation.options.output.path, path.dirname(self.childCompilationOutputName)), compilation.options.output.path)
.split(path.sep).join('/');
if (publicPath.length && publicPath.substr(-1, 1) !== '/') {
publicPath += '/';
}

Afterwards it is prepended for all files:

let chunkFiles = [].concat(chunk.files).map(chunkFile => publicPath + chunkFile);

@stale
Copy link

stale bot commented Oct 23, 2018

This issue had no activity for at least half a year. It's subject to automatic issue closing if there is no activity in the next 15 days.

@stale stale bot added the wontfix label Oct 23, 2018
@stale stale bot closed this as completed Nov 7, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Dec 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants