-
-
Notifications
You must be signed in to change notification settings - Fork 376
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
publicPath Option Confusion #269
Comments
output.publicPath
not respected when running middleware from webpack-serve
Thanks for migrating this issue over here. So far as I can tell, webpack-dev-server does set a But that doesn't really take into consideration or provide a means to accurately parse a In any case, I think I can update WDM to handle almost all situations. The ones that get tricky are when the user uses a url without protocol, for example. The relative paths are also going to be a trick. It's going to take some time to get this right, given the silly myriad of options that webpack allows for in |
Closing due to inactivity and age. |
@shellscape i think this issue it's something that should be discussed. I had the same problem. Until I found that i have to set "serve.dev.publicPath".. Better to change behaviour or, even better improve docs. This is the opposite of developer friendly. Devs dont want to be experts in webpack.. It's just a tool. EDIT: |
- webpack-serve is the more modern version of webpack-dev-server - made by some of the same folks I believe - also add webpack-serve-waitpage for build progress and webpack-serve-overlay for error overlays - overlay needed a new entry so that it show errors that occur after it's conditionally `require`d - debug a bunch of publicPath and routing issues and add more explicit comments - see webpack-contrib/file-loader#246 , webpack/webpack-dev-middleware#269 , and webpack-contrib/webpack-serve#238 - TODO: experiment with publicPath for production / CDN as it may not work perfectly anymore - (docs): add docs for hmr and reword some of README
Just spent a few hours debugging this and was super confused. Came here from the related issue in As far I could tell, It seemed like there might be a need for a utility library for webpack libs to interpret Sample for anyone who might find it useful/helpful:
|
[email protected]
usesDescription
This is a repost of webpack-contrib/webpack-serve#24 in
webpack-serve
. I was told the bug actually has to do withwebpack-dev-middleware
.Hopefully @shellscape can provide some additional context as I'm not 100% sure what the internal issues are.
webpack.config.js
Expected Behavior
In the config above, note that
serve.dev.publicPath
is included. This seems to be the only way to getwebpack-serve
to serve content out of the/build
directory, even though I haveoutput.publicPath
also set to/build
.I was expecting NOT needing the
serve.dev.publicPath
value to need to be set, but without it the web server serves the content out ofhttp://localhost/app.js
instead ofhttp://localhost/build/app.js
.Actual Behavior
The
output.publicPath
value of the config is not respected when runningwebpack-server
.Furthermore, the behavior of
output.publicPath
andserve.dev.publicPath
is slightly different. Theoutput
value is global (so I use./build
), but theserve
value is relative, so I have to use/build
(note the lack of initial dot).This was highly unexpected when migrating from
webpack-dev-server
towebpack-serve
and I ended up losing quite a lot of time during the migration. If this is behavior is as-designed, would it be possible to explicitly describe this in the docs so other people who run into this aren't as surprised?The text was updated successfully, but these errors were encountered: