-
Notifications
You must be signed in to change notification settings - Fork 1
/
vue.config.js
executable file
·41 lines (38 loc) · 1.04 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
const HtmlWebpackPlugin = require('html-webpack-plugin');
const isProd = process.env.NODE_ENV === 'production';
const entry =isProd ? 'src/main.pro.js' : 'src/main.dev.js';
module.exports = {
configureWebpack: config => {
config.plugins.forEach((val) => {
if (val instanceof HtmlWebpackPlugin) {
val.options.title = "页面级组件"
val.options.isProd = isProd ? true : false;
}
})
if(isProd) {
// 生产模式
config.externals = {
'vue': 'Vue',
// 'vue-router': 'VueRouter',
// 'axios': 'axios',
// 'i18n': 'i18n',
'element-ui': 'element-ui'
}
// window全局查找key来进行使用 不会打包
}
},
// 用于多页配置,默认是 undefined
pages: {
index: {
// 入口文件
entry,/*这个是根入口文件*/
// 模板文件
template: 'public/index.html',
// 输出文件
filename: 'index.html',
// 页面title
// title: '页面级组件'
},
// subpage: 'src/main.pro.js'
},
}