-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Support for minikube/k8s/docker with port remap #1284
Description
- Operating System: OSX 10.13.2
- Node Version: 8.9.3
- NPM Version: 5.6.0
- webpack Version: 3.10.0
- webpack-dev-server Version: 2.11.0
- This is a bug
- This is a modification request
Code
port: 4000
hot: true
portRemap: 30100 // new optionExpected Behavior
Be able to specify a regular port for webpack-dev-server to listen on, but specify a custom port for the HMR requests to call back to. Would expect this to start webpack-dev-server on localhost:4000, and send HMR requests back to localhost:30100. This becomes incredibly useful when WDS is running behind something else that maps localhost:4000 to arbitrary.endpoint:customPort such as Docker or k8s/minikube.
Actual Behavior
No such option.
For Features; What is the motivation and/or use-case for the feature?
We're running a local Minikube k8s setup. This typically maps some service port (e.g. 4000) to an external NodePort (e.g. 30100) that is then available on an address like http://192.168.64.12:30100. The problem is obviously that "hot" mode only looks to the port config (in our case that would be 4000) which ends up sending HMR requests to our k8s system on http://192.168.64.12:4000 - an unknown port that returns an error.
Updating /lib/util/createDomain.js to use options.portRemap if present, or the existing behaviour if not would let WDS work with Docker/minikube/k8s setups.
Is this kind of thing open for a PR?