webpack dev server 无法通过ip访问问题

来源:互联网 发布:如何取淘宝店名 编辑:程序博客网 时间:2024/05/16 17:14

同事开发前端项目,通过webpack-dev-server起的服务,本地localhost:300正常访问,而同一个局域网内其他同事无法通过她机器ip访问。


解决方法:

(If you're on a Mac and network like mine.)

Run webpack-dev-server with --host 0.0.0.0 — this lets the server listen for requests from the network, not just localhost.

Find your computer's address on the network. In terminal, type ifconfig and look for the en1section or the one with something like inet 192.168.1.111

In your mobile device on the same network, visit http://192.168.1.111:8080 and enjoy hot reloading dev bliss.


参考:https://stackoverflow.com/questions/35412137/how-to-get-access-to-webpack-dev-server-from-devices-in-local-network

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

原创粉丝点击