forked from ant-design/ant-design-mobile
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsvg.config.js
33 lines (32 loc) · 1.02 KB
/
svg.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
'use strict';
module.exports = function (config, includeDemo) {
let svgDirs = [
/components\/icon\/style\/assets/,
/components\/notice-bar\/style\/assets/,
/components\/toast\/style\/assets/,
];
if (includeDemo) {
svgDirs = svgDirs.concat([
/components\/steps\/demo/,
/components\/icon\/demo/,
/components\/popover\/demo/,
/components\/action-sheet\/demo/,
/components\/result\/demo/,
]);
}
// exclude the default svg-url-loader from atool-build https://github.com/ant-tool/atool-build/blob/master/src/getWebpackCommonConfig.js#L161
config.module.loaders.forEach(loader => {
if (loader.test.toString() === '/\\.svg(\\?v=\\d+\\.\\d+\\.\\d+)?$/') {
loader.exclude = svgDirs;
}
});
// Note: https://github.com/kisenka/svg-sprite-loader/issues/4
// Can not process SVG files twice
if (config.module.loaders[0].loader !== 'svg-sprite') {
config.module.loaders.unshift({
test: /\.svg$/,
loader: 'svg-sprite',
include: svgDirs,
});
}
};