主要是为了调试方便。
本地 IP: 198.0.1.2 防火墙已经关闭
然后用 webpack-dev-server 启动后,端口是 8080. 本地访问: http://locahost:8080/可以成功
另外一台机器 198.0.1.10 访问 http://198.0.1.2:8080 提示我
This site can’t be reached
198.0.1.2 refused to connect.
我添加了启动参数,比如:--public 0.0.0.0:8080 (或者 --public 198.0.1.2:8080 )看命令行,提示 server 启动成功,但是在浏览器里面输入 http://0.0.0.0:8080 直接提示我错误(就更别提远程访问了)
This site can’t be reached
The webpage at http://0.0.0.0:8080/ might be temporarily down or it may have moved permanently to a new web address.
google 了一下,什么 allowedHosts ,disableHostCheck 参数也设置了,貌似没有啥用。
p.s. refer to:
https://github.com/webpack/webpack-dev-server/issues/882