vue-shop/vue.config.js
2022-02-20 18:57:29 +08:00

49 lines
1.5 KiB
JavaScript

/*
* @Description:
* @Version: 1.0
* @Autor: zhuyijun
* @Date: 2022-02-17 14:34:36
* @LastEditTime: 2022-02-20 16:43:39
*/
module.exports = {
chainWebpack: config => {
//发布模式
config.when(process.env.NODE_ENV === 'production', config => {
config.entry('app').clear().add('./src/main-prod.js')
//通过 externals 加载外部cdn资源
config.set('externals', {
vue: 'Vue',
'vue-router': 'VueRouter',
axios: 'axios',
lodash: '_',
echarts: 'echarts',
nprogress: 'NProgress',
'vue-quill-editor': 'VueQuillEditor'
})
config.plugin('html').tap(args => {
args[0].isProd = true
return args
})
})
//开发模式
config.when(process.env.NODE_ENV === 'development', config => {
config.entry('app').clear().add('./src/main-dev.js')
//通过 externals 加载外部cdn资源
config.set('externals', {
vue: 'Vue',
'vue-router': 'VueRouter',
axios: 'axios',
lodash: '_',
echarts: 'echarts',
nprogress: 'NProgress',
'vue-quill-editor': 'VueQuillEditor'
})
config.plugin('html').tap(args => {
args[0].isProd = false
return args
})
})
},
lintOnSave: false
}