webpack-dev-server icon indicating copy to clipboard operation
webpack-dev-server copied to clipboard

feat: publicPath output

Open adubrouski opened this issue 10 months ago • 1 comments

  • [ ] 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

adubrouski avatar Mar 16 '25 11:03 adubrouski

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: adubrouski / name: Anton Dubrouski (9e1279dc224425e35395caa16a5b100f6ef9522a, ac92924bdfb1b88c46b5a2366c1af0e9bc688a17)