-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
58 lines (57 loc) · 1.45 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
52
53
54
55
56
57
58
const path = require('path')
const isProd = process.env.NODE_ENV === 'production'
const cdn = {
externals: {
"vue": 'Vue',
"ant-design-vue": 'ant',
},
js: [
'https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js',
'https://cdnjs.cloudflare.com/ajax/libs/ant-design-vue/1.7.8/antd.min.js',
'https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-virtual-scroller.umd.min.js'
],
css: [
'https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-virtual-scroller.min.css'
]
}
module.exports = {
devServer: {
port: 3000,
},
transpileDependencies: [],
pages: {
index: {
entry: 'examples/main.js',
template: 'public/index.html',
filename: 'index.html'
}
},
configureWebpack: (config) => {
if (isProd) config.externals = cdn.externals
},
chainWebpack: (config) => {
config.resolve.alias
.set('@', path.resolve('examples'))
.set('~', path.resolve('packages'))
if (isProd && process.env.VUE_CLI_BUILD_TARGET !== 'lib') {
// 多入口需要设定入口
config.plugin('html-index').tap(args => {
args[0].cdn = cdn
return args
})
}
// 打包分析
if (process.env.use_analyzer) {
config.plugin('webpack-bundle-analyzer')
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
}
},
css: {
loaderOptions: {
less: {
modifyVars: {},
javascriptEnabled: true
}
}
},
}