-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathvue.config.js
56 lines (53 loc) · 1.26 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
function resolve(dir) {
return path.join(__dirname, dir)
}
const isProd = ['production', 'prod'].includes(process.env.NODE_ENV)
const assetsCDN = {
externals: {
vue: 'Vue',
axios: 'axios',
'ant-design-vue': 'antd',
},
js: [
'https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js',
'https://cdn.jsdelivr.net/npm/[email protected]/dist/axios.min.js',
'https://cdn.jsdelivr.net/npm/[email protected]/dist/antd.min.js',
],
css: [
'https://cdn.jsdelivr.net/npm/[email protected]/dist/antd.min.css',
]
}
module.exports = {
configureWebpack: {
externals: isProd ? assetsCDN.externals : {},
},
chainWebpack: config => {
if (isProd) {
//cdn配置
config.plugin('html').tap(args => {
if (args && args[0]) {
args[0].assets = assetsCDN
}
return args
})
}
},
css: {
loaderOptions: {
less: {
modifyVars: {},
// do not remove this line
javascriptEnabled: true
}
}
},
pluginOptions: {
'nuxt-less-resources-loader': [
'node_modules/ant-design-vue/es/style/themes/default.less'
],
'style-resources-loader': {
preProcessor: 'less',
patterns: ['node_modules/ant-design-vue/es/style/themes/default.less']
}
}
}