如何使用外部 IP 访问 webpack-dev-server
How to get access to webpack-dev-server with external IP
我已经将我的简单登录网站完全编码并在 webpack 开发服务器上运行。我怎样才能用我的外部IP显示它?我已经在端口 9000 上转发了我的路由器,但是当我尝试 www.myIp:portnumber 时它不起作用。
下面是我的 webpack 开发服务器的 webpack 配置。
//Webpack config
module.exports = {
entry: './app/main.js',
output: {
path: './app',
filename: 'bundle.js'
},
devServer: {
inline: true,
contentBase: './app',
port: 9000
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel'
}
]
}
}
设置主机属性:
devServer: {
inline: true,
contentBase: './app',
port: 9000,
host: '0.0.0.0'
}
https://webpack.js.org/configuration/dev-server/#devserver-host-cli-only
我已经将我的简单登录网站完全编码并在 webpack 开发服务器上运行。我怎样才能用我的外部IP显示它?我已经在端口 9000 上转发了我的路由器,但是当我尝试 www.myIp:portnumber 时它不起作用。 下面是我的 webpack 开发服务器的 webpack 配置。
//Webpack config
module.exports = {
entry: './app/main.js',
output: {
path: './app',
filename: 'bundle.js'
},
devServer: {
inline: true,
contentBase: './app',
port: 9000
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel'
}
]
}
}
设置主机属性:
devServer: {
inline: true,
contentBase: './app',
port: 9000,
host: '0.0.0.0'
}
https://webpack.js.org/configuration/dev-server/#devserver-host-cli-only