-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-overrides.js
46 lines (38 loc) · 1.28 KB
/
config-overrides.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
const { override, addWebpackAlias, addDecoratorsLegacy, addLessLoader, addWebpackModuleRule } = require('customize-cra');
const path = require('path')
// const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
// const smp = new SpeedMeasurePlugin();
const rewireLess = require('react-app-rewire-less');
module.exports = override(
addWebpackAlias({
"@": path.resolve(__dirname, 'src'),
"components": path.resolve(__dirname, 'src/components'),
"hooks": path.resolve(__dirname, 'src/hooks/index.js'),
}),
addDecoratorsLegacy(),
addWebpackModuleRule({
test: /\.svg$/, use: [
{ loader: 'svg-sprite-loader', options: {} },
{
loader: 'svgo-loader', options: {
plugins: [
],
}
},
]
}),
addLessLoader({
lessOptions: {
}
}),
(config) => {
const loaders = config.module.rules.find(rule => Array.isArray(rule.oneOf)).oneOf;
loaders[8].use.push({
loader: 'style-resources-loader',
options: {
patterns: path.resolve(__dirname, 'src/styles/common.less')//全局引入公共的scss 文件
}
})
return config
}
)