1、vue.config.js
设置publicPath路径为反向代理路径:
publicPath: ‘/test/’,
module.exports = {
/*
Vue-cli3:
Crashed when using Webpack `import()` #2463
https://github.com/vuejs/vue-cli/issues/2463
*/
// 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
productionSourceMap: false,
//打包app时放开该配置
//publicPath:'./',
publicPath: '/test/',
}
devServer: {
port: 3000,
2、nginx反向代理 test路径
location /archive {
#root html;
#index index.html index.htm;
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
client_max_body_size 220m;
proxy_pass http://192.168.1.65;
}
3、