How to make the webpack dev server run on port 80 and on 0.0.0.0 to make it publicly accessible?

后端 未结 13 1289
时光取名叫无心
时光取名叫无心 2020-11-30 17:36

I am new to the whole nodejs/reactjs world so apologies if my question sounds silly. So I am playing around with reactabular.js.

Wh

13条回答
  •  隐瞒了意图╮
    2020-11-30 17:51

    Something like this worked for me. I am guessing this should work for you.

    Run webpack-dev using this

    webpack-dev-server --host 0.0.0.0 --port 80
    

    And set this in webpack.config.js

    entry: [
        'webpack-dev-server/client?http://0.0.0.0:80',
         config.paths.demo
     ]
    

    Note If you are using hot loading, you will have to do this.

    Run webpack-dev using this

    webpack-dev-server --host 0.0.0.0 --port 80
    

    And set this in webpack.config.js

    entry: [
        'webpack-dev-server/client?http://0.0.0.0:80',
        'webpack/hot/only-dev-server',
         config.paths.demo
     ],
    
    ....
    plugins:[new webpack.HotModuleReplacementPlugin()]
    

提交回复
热议问题