We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
网上大部分都是写的什么改
const HOST = 'x.x.x.x:8080' // 假设端口是8080
或者命令行模式增加添加参数 --host 0,0,0,0 但是大概率还是不行的。
--host 0,0,0,0
首先在webpack dev server inline模式下,如果是命令行模式模式,是这样就可以了
webpack-dev-server --inline
这样的话加host 设置0.0.0.0是比较简单的, 但是对于nodejs调用webpack-dev-server的话则是这样的
0.0.0.0
entry: [ 'webpack-dev-server/client?http://localhost:8080', config.paths.demo ],
但是这个也只是启动localhost的 如果需要变成ip的话只需要这样就可以了
entry: [ 'webpack-dev-server/client?http://0.0.0.0:8080', config.paths.demo ]
另外还有一个技巧是打开浏览器的ip地址可以用devServer的配置useLocalIp: true
useLocalIp: true
const server = new webpackDevServer(compiler, { hot: true, quiet: true, historyApiFallback: true, filename: config.output.filename, publicPath: config.output.publicPath, // host: getIPAddress(), stats: { colors: true }, open: true, useLocalIp: true }) server.listen(PORT)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
网上大部分都是写的什么改
或者命令行模式增加添加参数
--host 0,0,0,0
但是大概率还是不行的。
首先在webpack dev server inline模式下,如果是命令行模式模式,是这样就可以了
这样的话加host 设置
0.0.0.0
是比较简单的,但是对于nodejs调用webpack-dev-server的话则是这样的
但是这个也只是启动localhost的
如果需要变成ip的话只需要这样就可以了
另外还有一个技巧是打开浏览器的ip地址可以用devServer的配置
useLocalIp: true
The text was updated successfully, but these errors were encountered: