No way to force webpack-dev-server client to use window.location
See original GitHub issue- Operating System: macOS 10.15.3
- Node Version: v12.16.0
- NPM Version: 6.13.4
- webpack Version: 4.41.6
- webpack-dev-server Version: 3.11.0
- Browser: Chrome 81
- This is a bug
- This is a modification request
Expected Behavior
There would be some configuration that would let me force webpack-dev-server’s hot client to use window.location
.
Actual Behavior
No configuration will cause webpack-dev-server’s hot client to not use __resourceQuery
, which in my case is always "?http://localhost:8080"
. As far as I can tell, I can’t get this behavior with the current configuration options.
For Features; What is the motivation and/or use-case for the feature?
I’m working on a cloud platform that provides dev environments, and it let’s you proxy requests to localhost via a domain. Out of the box, webpack-dev-server doesn’t work since it tries to hit localhost:8080/sockjs-node
. We’ve been working around this by setting public
to an environment variable, but the annoying thing is that everyone gets a different domain. It’d be ideal if we could just set a flag on the devServer
config that told it to always use window.location
so each user wouldn’t have to configure an environment variable.
It’s worth noting that create-react-app doesn’t encounter this because of their custom hot client, which has much simpler logic: https://github.com/facebook/create-react-app/blob/master/packages/react-dev-utils/webpackHotDevClient.js#L59-L69
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
For folks Googling their way here looking for answers, this hack proposed a few years ago still works (from #1240):
…to get the client to fallback to
window.location
.@lperiodbose thanks, let’s close in favor https://github.com/webpack/webpack-dev-server/issues/1240, try to find time on it for v4