Home  >  Q&A  >  body text

webpack-dev-server remote server configuration - Stack Overflow

Scenario before configuration:

远程服务器nginx上配置了多域名端口均为80,比如配置另一个test.com,远程机器ip:10.10.10.1
本地配置host: 10.10.10.1 test.com,浏览器里输入test.com即可打开网站

After configuration, I hope that the website can still be opened by accessing test.com, and that the js file can be automatically refreshed after modifying it

webpack.config.js configuration is as follows:

{
    entry: {
    
        test:`/es/test.es`
    },
    output: {
        path: Path.resolve('../', 'build/js/'),
        
        filename: '[name].js'
    },
    devServer: {
        proxy: {
            "/build/js/test.js": 'http://test.com/build/js/test.js'
        },
        contentBase: '../build/js/',
        watchContentBase: true,
        public:'test.com'
}
}

There is only one sentence configured in package.json
"start": "webpack-dev-server",

But the modified file is not automatically refreshed
After the file is changed, automatic compilation can be performed, but the accessed test.com is not automatically refreshed
Please answer

我想大声告诉你我想大声告诉你2732 days ago476

reply all(2)I'll reply

  • 滿天的星座

    滿天的星座2017-05-19 10:34:15

    Add a sentence --inline --hot Try it

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-19 10:34:15

    entry: ['webpack/hot/dev-server', path.resolve(__dirname, './app/main.js')],
    这样定义试试

    reply
    0
  • Cancelreply