-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
46 lines (40 loc) · 1.36 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
module.exports = {
devServer: {
port: 8900,
disableHostCheck: true
},
// 删除打包时生成的那些js.map文件
/* 参考网址:https://blog.csdn.net/Future1994/article/details/84943245?utm_medium=
distribute.pc_relevant.none-task-blog-title-6&spm=1001.2101.3001.4242 */
productionSourceMap: process.env.NODE_ENV !== 'production',
chainWebpack: config => {
// 产品发布阶段
config.when(process.env.NODE_ENV === 'production', config => {
config.entry('app').clear().add('./src/main-prod.js')
// 使用externals设置排除项
config.set('externals', {
vue: 'Vue',
'vue-router': 'VueRouter',
axios: 'axios',
lodash: '_',
echarts: 'echarts',
nprogress: 'NProgress',
'vue-quill-editor': 'VueQuillEditor'
})
// 向html插件中增加一个属性,用于判断是否向页面渲染特定内容
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')
// 向html插件中增加一个属性,用于判断是否向页面渲染特定内容
config.plugin('html').tap(args => {
args[0].isProd = false
return args
})
})
}
}