webpack-dev-server
webpack-dev-server copied to clipboard
feat: publicPath output
- [ ] This is a bugfix
- [x] This is a feature
- [ ] This is a code refactor
- [x] This is a test update
- [ ] This is a docs update
- [ ] This is a metadata update
For Bugs and Features; did you add new tests?
Yes
Motivation / Use-Case
Some applications use public paths (to avoid strong differences between dev and prod builds). I set it via output.publicPath, and it seems a bit inconvenient to me that the urls in the terminal are obtained without taking publicPath into account. These can be simple applications without routing, and you have to go to / and then manually add publicPath. I suggest outputting the url with publicPath if it is set statically, if it is determined on the fly - output without it.
Now, with config like this:
output: {
publicPath: "/my-public-path/",
}
We getting this:
<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:8080/, http://[::1]:8080/
<i> [webpack-dev-server] On Your Network (IPv4): http://10.252.1.16:8080/
<i> [webpack-dev-server] Content not from webpack is served from '/home/user/Project/src' directory
<i> [webpack-dev-server] 404s will fallback to '/index.html'
My proposal is:
<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:8080/my-public-path/, http://[::1]:8080/my-public-path/
<i> [webpack-dev-server] On Your Network (IPv4): http://10.252.1.16:8080/my-public-path/
<i> [webpack-dev-server] Content not from webpack is served from '/home/user/Project/src' directory
<i> [webpack-dev-server] 404s will fallback to '/index.html'
Breaking Changes
No
Additional Info
No