提交 | 用户 | age
|
aeb317
|
1 |
'use strict' |
J |
2 |
const path = require('path') |
|
3 |
function resolve(dir) { |
|
4 |
return path.join(__dirname, dir) |
|
5 |
} |
|
6 |
module.exports = { |
|
7 |
// 配置使用stylus全局变量 |
|
8 |
chainWebpack: config => { |
|
9 |
// set svg-sprite-loader |
|
10 |
config.module |
|
11 |
.rule('svg') |
|
12 |
.exclude.add(resolve('src/icons')) |
|
13 |
.end() |
|
14 |
config.module |
|
15 |
.rule('icons') |
|
16 |
.test(/\.svg$/) |
|
17 |
.include.add(resolve('src/icons')) |
|
18 |
.end() |
|
19 |
.use('svg-sprite-loader') |
|
20 |
.loader('svg-sprite-loader') |
|
21 |
.options({ |
|
22 |
symbolId: 'icon-[name]' |
|
23 |
}) |
|
24 |
.end() |
|
25 |
} |
|
26 |
} |