javascript - Access Webpack Dev Server on another LAN PC - Stack Overflow

I created an app with create-react-app and the webpack-dev-server uses the react-scripts to load up the

I created an app with create-react-app and the webpack-dev-server uses the react-scripts to load up the dev-server. The problem is i cannot access the dev server via other LAN PC. Any idea how to solve this? I also have a .env file where i change the default HOST name to domain.

I want to access the dev-server via my iPad for example. Earlier i just typed in the IP of the PC and the port and it worked.

I would appreciate any help

I created an app with create-react-app and the webpack-dev-server uses the react-scripts to load up the dev-server. The problem is i cannot access the dev server via other LAN PC. Any idea how to solve this? I also have a .env file where i change the default HOST name to domain..

I want to access the dev-server via my iPad for example. Earlier i just typed in the IP of the PC and the port and it worked.

I would appreciate any help

Share Improve this question asked Feb 5, 2019 at 9:59 Nenad KaevikNenad Kaevik 1751 gold badge4 silver badges20 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

according to https://webpack.js/configuration/dev-server/#devserverhost just simply by adding

module.exports = {
  //...
  devServer: {
    host: '0.0.0.0'
  }
};

or directly via cli

webpack-dev-server --host 0.0.0.0

i have the same problem, i resolve with this: Example IP: 192.168.0.35 'webpack.dev.config.js'

module.exports {
  output: {
    publicPath: 'http://192.168.0.35:3001/'
  },
  devServer: {
    port: 3001,
    host: '192.168.0.35'
  }
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744487571a4576655.html

相关推荐

  • javascript - Access Webpack Dev Server on another LAN PC - Stack Overflow

    I created an app with create-react-app and the webpack-dev-server uses the react-scripts to load up the

    22小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信