4

Per the docs here and here, I have the following in my package.json

"scripts": {
  "start": "webpack-dev-server --host 0.0.0.0 --open",
  ...

With just --open it opens localhost:8080 when I run npm start. When I add in --host 0.0.0.0 it still opens, but opens 0.0.0.0:8080 and gives me ERR_EMPTY_RESPONSE in the browser. I can manually change it to localhost:8080 and it loads the page just fine.

I tried --host 0.0.0.0 --open --open-page localhost:8080 and it dutifully opens http://0.0.0.0:8080/localhost:8080 for me in the browser.

Has anyone gotten these two options to play nicely together?

1
  • Not sure if something like <my machine IP>:8080 would work, but I'm not much inclined to try, since its.. y'know.. in git. I assumed the 0.0.0.0 is a hint to listen for traffic on whatever machine it's run on. Commented Dec 6, 2017 at 21:48

1 Answer 1

6
+50

Below works fine for me

webpack-dev-server -p --public 127.0.0.1:9000 --host 0.0.0.0 --port 9000

--host is the listening interface. --public is for what would be opened in the browser. And --open-page is for appending the page url after the main domain

Sign up to request clarification or add additional context in comments.

1 Comment

awesome - thanks. I'm now using webpack-dev-server -p --public localhost:8080 --host 0.0.0.0 --port 8080 --open and it's working great. The --public option was what I was missing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.