-
-
Notifications
You must be signed in to change notification settings - Fork 387
loader.options.publicPath
not being honored
#222
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
Comments
I am also experiencing this. I try to break it down below, with my current solution. Webpack output object
Loader object
Finally, the plugin config
This will generate the Styles.css at
|
I've also survived by putting the relative path in plugins filename. However I feel the publicPath -option should work? Also what is curious about the relative path -solution is that if I use html -templates that are generated from builds, the style src -paths there will contain the relative portion, which is a bit ugly. It's not a big issue, but would love to find a reasonably easy way to get rid of those! :) |
Yes, I have also seen the relative path looking a little ugly. My real world project looks like this: <link href="/App/JavaScript/../StyleSheets/CSS/Styles.css" rel="stylesheet"> Again, I agree it is not a big issue and it does work this way. const publicPath =
typeof query.publicPath === 'string'
? query.publicPath
: this._compilation.outputOptions.publicPath;
const outputOptions = {
filename: childFilename,
publicPath,
}; My only thought looking at it was that |
Nope, not that simple unfortunately! |
Thanks for checking that out, regardless! :) I couldn't get some sleep so I checked somethings too. After testing older setup with older Webpack and extract-text-webpack-plugin, I noticed that doesn't seem to work either with |
I'm not sure I'm following, sometimes it seems
...
output: {
path: path.resolve(__dirname, 'app/'),
publicPath: "app/" // http://localhost:3000
}
...
new MiniCssExtractPlugin({
filename: "styles/styles.css" // Note the `styles/`
})
|
To be exact the issue is that I'm having comes into play in a structure like this:
What I'm inclining here is that I cannot seem to get any configuration where applying a
...relative binding in the plugin, which then forms a path in
This works, and it's not the end of the world, but that relative part in production code kinda bugs me a bit. 😃 But if I have understood something wrong in my usage, please point that out! |
kk what is inlining the paths atm, the |
loader.options.publicPath
not being honored
Yes, this definetely sounds like the case! Thank you so much for addressing this. 👍 I don't have a good spot to check right now, but I could try to check what difference removing |
kk 👍, if it is the |
@michael-ciniawsky I'm having the problem too, and I have a barebones setup with nothing
|
No that's not the effect of the Use |
@sokra What would be the correct config to place the css inside a subfolder without being able to set a public path? Relative paths inside the following example would just not work:
|
For this filename you probably need |
thanks @sokra I’ll tried that but this issue is about the problem that this seems to be broken - could you please post a small example for the loader + plugin configuration which would allow to generate the css file into a sub folder? |
Besides that
File structure after build looks like this:
If i change The file structure after build looks like this:
This means that in my case |
We are using |
Fixed in master, now |
Uh oh!
There was an error while loading. Please reload this page.
Hi!
If I haven't been mistaken, should the
publicPath
-option allow me to output generated bundles to the given destination?My baseconfig has this as publicPath:
Then on my derived production config has:
I'm attempting to get a structure where JS goes to
public/scripts/
and CSSpublic/styles
.JS ends up in the right place. The CSS doesn't seem to.
The text was updated successfully, but these errors were encountered: