/** * 配置参考: * https://cli.vuejs.org/zh/config/ */ const url = process.env.VUE_APP_BASE_API // 配置.env文件通过运行命令启动不同调试环境 const productionGzipExtensions = ['js', 'css'] module.exports = { lintOnSave: true, productionSourceMap: false, chainWebpack: config => { const entry = config.entry('app') entry .add('babel-polyfill') .end() entry .add('classlist-polyfill') .end() }, css: { // 忽略 CSS order 顺序警告 extract: { ignoreOrder: true } }, configureWebpack: (config) => { if (process.env.NODE_ENV === 'production') { // 仅在生产环境下启用该配置 return { performance: { // 打包后最大文件大小限制 maxAssetSize: 1024000 }, } } }, // 配置转发代理 devServer: { open: true, disableHostCheck: true, port: 8080, proxy: { '/': { target: url, ws: false, // 需要websocket 开启 pathRewrite: { '^/': '/' } }, // 3.5 以后不需要再配置 } } }