-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvue.config.js
42 lines (42 loc) · 1.07 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
const webpack = require('webpack')
const isProd = process.env.NODE_ENV === 'production'
const assetsCDN = {
// webpack build externals
externals: {
vue: 'Vue',
'element-ui': 'ELEMENT',
dayjs: 'dayjs'
},
css: [
'//unpkg.com/element-ui/lib/theme-chalk/index.css'
],
js: [
'//cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js',
'//cdn.jsdelivr.net/npm/[email protected]/dayjs.min.js',
'//unpkg.com/element-ui/lib/index.js'
]
}
module.exports = {
publicPath: process.env.NODE_ENV === "production" ? "/flappy-learning" : "/",
outputDir: 'dist/flappy-learning',
configureWebpack: {
// webpack plugins
plugins: [
// Ignore all locale files of moment.js
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
],
// if prod, add externals
externals: isProd ? assetsCDN.externals : {}
},
chainWebpack: config => {
// if prod is on
// assets require on cdn
if (isProd) {
config.plugin('html').tap(args => {
args[0].cdn = assetsCDN
return args
})
}
},
productionSourceMap: false
};