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
Add a sentence
--inline --hot
Try it