webpack-dev-server remote server configuration - Stack Overflow
我想大声告诉你
我想大声告诉你 2017-05-19 10:32:15
0
2
504

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

我想大声告诉你
我想大声告诉你

reply all(2)
滿天的星座

Add a sentence --inline --hot Try it

漂亮男人
entry: ['webpack/hot/dev-server', path.resolve(__dirname, './app/main.js')],
这样定义试试
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template