1.项目使用ivew-admin
2.问题为:脚本bulid:uat 的时候 构建的js、css 没有被chunk 为小文件;但是 build:production 的时候 js,css 都被chunk了的;
如图:
bulid:uat
build:production
- bulid:uat 对于的脚本为:"build:uat": "cross-env NODE_ENV=uat vue-cli-service build",
"build:production": "vue-cli-service build",
4.vue.config.js 的配置为:
module.exports = {
// Project deployment base
// By default we assume your app will be deployed at the root of a domain,
// e.g. https://www.my-app.com/
// If your app is deployed at a sub-path, you will need to specify that
// sub-path here. For example, if your app is deployed at
// https://www.foobar.com/my-app/
// then change this to '/my-app/'
baseUrl: BASE_URL,
// tweak internal webpack configuration.
// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
// webpack插件配置
configureWebpack: config => {
let plugins = []
// if (process.env.NODE_ENV !== 'development') {
config.plugins = [...config.plugins, ...plugins]
// }
},
chainWebpack: config => {
config.resolve.alias
.set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components'))
.set('_c', resolve('src/components'))
.set('_conf', resolve('config'))
},
// 打包时不生成.map文件
productionSourceMap: false,
// 这里写你调用接口的基础路径,来解决跨域,如果设置了代理,那你本地开发环境的axios的baseUrl要写为 '' ,即空字符串
// devServer: {
// proxy: 'http://management-test2.tuhuanjk.com'
// }
devServer: {
proxy: {
'/api': {
target: '',
changeOrigin: true
}
}
}
}
请大神指导一下,目标是想 运行 bulid:uat 时,同样chunk,js 和 css 文件; 谢谢!
chunk只是一个文件命名而已,你是指uat环境下没有被压缩代码?