-
Notifications
You must be signed in to change notification settings - Fork 7
/
vue.config.js
51 lines (49 loc) · 1.34 KB
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const path = require('path')
function resolve(dir) {
return path.join(__dirname, dir)
}
module.exports = {
publicPath: '/',
outputDir: 'dist',
lintOnSave: true,
devServer: {
compress: false,
open: true
},
chainWebpack: (config) => {
config.resolve.alias
.set('assets', resolve('src/assets'))
.set('components', resolve('src/components'))
.set('network', resolve('src/network'))
.set('views', resolve('src/views'))
.set('store', resolve('src/store'))
.set('common', resolve('src/common'))
.set('element', resolve('src/element'))
// 发布
config.when(process.env.NODE_ENV === 'production', (config) => {
// 打包入口
config.entry('app').clear().add('./src/main-prod.js')
config.set('externals', {
vue: 'Vue',
vuex: 'Vuex',
'vue-router': 'VueRouter',
axios: 'axios',
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')
config.plugin('html').tap((args) => {
args[0].isProd = false
return args
})
})
}
}