Cannot run webpack-dev-server inside docker

前端 未结 3 1603
遥遥无期
遥遥无期 2021-02-01 20:46

I have created a docker image which serves a simple react app using webpack from inside the container, but I get nothing in the browser.

Here are my config files

3条回答
  •  南笙
    南笙 (楼主)
    2021-02-01 21:34

    You are actualy listening on localhost only. To be reachable from outside replace the following line in your package.json file:

    "start": "webpack-dev-server --inline --content-base ."
    

    by :

    "start": "webpack-dev-server --host 0.0.0.0 --inline --content-base ."
    

    Related discussion : https://github.com/webpack/webpack-dev-server/issues/147

提交回复
热议问题