-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvue.config.js
30 lines (27 loc) · 1016 Bytes
/
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
const path = require('path')
module.exports = {
publicPath: '/',
chainWebpack:(config)=>{
config.resolve.alias
.set('@assets',path.join(__dirname,'./src/assets'))
.set('@components',path.join(__dirname,'./src/components'))
.set('@plugins',path.join(__dirname,'./src/plugins'))
.set('@views',path.join(__dirname,'./src/views'))
.set('@apis',path.join(__dirname,'./src/apis'))
.set('@utils',path.join(__dirname,'./src/utils'))
config.resolve.extensions
.add('.js')
.add('.vue')
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
types.forEach(type => addStyleResource(config.module.rule('less').oneOf(type)))
}
}
function addStyleResource(rule) {
rule.use('style-resource')
.loader('style-resources-loader')
.options({
patterns: [
path.resolve(__dirname, './src/assets/less/common.less'), // 需要全局导入的less
],
})
}