您的位置:首页 > Web前端 > Webpack

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

2017-07-17 15:15 2141 查看
同事开发前端项目,通过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 
en1
section
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: