-
Notifications
You must be signed in to change notification settings - Fork 1
/
config-overrides.ts
42 lines (40 loc) · 1.08 KB
/
config-overrides.ts
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
const {
override,
fixBabelImports,
addLessLoader,
addWebpackAlias,
addBabelPlugins, // babel插件配置函数
} = require('customize-cra');
const path = require("path");
const rewireRemoveConsolePlugin = require('./react-app-rewired-packages/react-app-rewire-remove-console.ts')
module.exports = override(
// 按需加载
fixBabelImports('import', {
libraryName: 'antd',
libraryDirectory: 'es',
style: 'css',
}),
// 启用less
addLessLoader({
strictMath: true,
noIeCompat: true,
javascriptEnabled: true,
modifyVars: { "@primary-color": "#1DA570" },
localIdentName: "[local]--[hash:base64:5]"
}),
//别名配置
addWebpackAlias({
["@"]: path.resolve(__dirname, "./src"),
["@pages"]: path.resolve(__dirname, "./src/pages"),
["@components"]: path.resolve(__dirname, "./src/components"),
["@models"]: path.resolve(__dirname, "./src/models")
}),
// 支持装饰器
...addBabelPlugins(
[
'@babel/plugin-proposal-decorators',
{ legacy: true }
],
rewireRemoveConsolePlugin()
),
);