【发布时间】:2017-06-24 07:25:10
【问题描述】:
您好,我正在研究 reactJS 想了解如何通过我在其他机器上的 IP 地址运行在 http://localhost:8888/index.html#/?_k=pu9k2u 上运行的本地 React 应用程序?
每当我执行“npm start”时,它总是在 localhost:8888 上运行
如何将其更改为在 0.0.0.0:8888 上运行?
我知道如何更改应用程序的端口,
以下是我的 webpack.congif.js
module.exports = {
entry: './index.js',
output: {
filename: 'index.js',
path: ''
},
devServer: {
inline:true,
port: 8888
},
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader?presets[]=es2015&presets[]=react' }
]
}
}
由于我对 reactJS 非常陌生,请解释下面给出的解决方案或提供更新的 webpack.config.js
How to make the webpack dev server run on port 80 and on 0.0.0.0 to make it publicly accessible?
【问题讨论】:
-
尝试打开localhost:3000隐身窗口。