vue-cli3之后都要寫在新建的vue.config.js文件夾中,一般配置如下:
devServer: {
host: '0.0.0.0',
port: 8002,
https: false, // https: {type: boolean}
open: true, //設置true為打開默認瀏覽器,也可以指定
proxy: {
'admin': {
target: 'http://192.168.1.171:10182',
ws: true, //設置websocket
changeOrigin: true, // 設置跨域
pathRewrite: { //設置更改前綴
'^/admin': ''
}
}
}
},
publicPath: './', // vue-cli3.3+版本使用