vue.config.js代码
module.exports = {
// 基本路径
publicPath: './',
// eslint-loader 是否在保存的时候检查
lintOnSave: true,
// 路径别名
configureWebpack: {
devtool: 'source-map',
resolve: {
alias: {
assets: '@/assets',
components: '@/components',
views: '@/views',
utils: '@/utils',
api: '@/api',
layout: '@/layout'
}
}
},
// 全局加载
css: {
loaderOptions: {
sass: {
prependData: '@import "src/assets/styles/variables.scss";'
}
}
},
// 服务代理配置
devServer: {
disableHostCheck: true,
https: false,
port: 8080,
open: true, // opens browser window automatically
proxy: {
// 渠道共享
'/api/': {
target: 'http://xxx.com:8080', // 测试环境
// target: 'http://172.xx.xx.xx:8080/', // 本地环境
changeOrigin: true,
pathRewrite: {
'^/api/': ''
}
},
// 配置
'/report': {
target: 'http://192.168.xxx.xx:8090/report', // mq配置
changeOrigin: true,
pathRewrite: {
'^/report/': ''
}
}
}
}
}