vue垮域问题,打包大小报错,访问css文件错误处理
在vue.config.js下配置
// vue.config.js
module.exports = {
publicPath: './', //配置访问静态文件路径
outputDir: 'dist', //打包存放目录
devServer: {
//port: 9999, //配置本地服务端口
//配置代理服务器
proxy: {
//当检测到路径中存在 /api 进入代理服务器
'/api': {
target: 'http://www.xxapid.com', // 目标服务器的地址
changeOrigin: true, //允许垮域
secure:false,//如果是 https 接口,需要配置这个参数
//将路径中的 /api 替换成空字符串
pathRewrite: {
'^/api': '' // 可以根据需要重写路径
}
}
}
},
configureWebpack: config => {
// 为生产环境修改配置...
if (process.env.NODE_ENV === 'production') {
config.mode = 'production';
// 打包文件大小配置
config.performance = {
maxEntrypointSize: 10000000,
maxAssetSize: 30000000
}
}
},
}
发表评论