-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig-overrides.js
48 lines (44 loc) · 1.6 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
47
48
const path = require("path");
const { configPaths, aliasJest } = require("react-app-rewire-alias");
const {
addWebpackAlias,
override,
fixBabelImports,
} = require("customize-cra");
// Add just the necessary icons to decrease bundle size
function overrides(config, env) {
config.resolve.alias["@ant-design/icons/lib/dist$"] = path.join(
__dirname,
"src/icons.js"
);
return config;
}
const aliasMap = configPaths("./tsconfig.paths.json"); // or jsconfig.paths.json
module.exports = override(
overrides,
addWebpackAlias({
"@assets": path.join(__dirname, "src/assets"),
"@constants": path.join(__dirname, "src/constants"),
"@components": path.join(__dirname, "src/shared/components"),
"@atom": path.join(__dirname, "src/shared/atom"),
"@molecules": path.join(__dirname, "src/shared/molecules"),
"@organism": path.join(__dirname, "src/shared/organism"),
"@constant": path.join(__dirname, "src/shared/constant"),
"@icons": path.join(__dirname, "src/shared/icons"),
"@layout": path.join(__dirname, "src/layout"),
"@Layout": path.join(__dirname, "src/shared/Layout"),
"@redux": path.join(__dirname, "src/redux"),
"@utils": path.join(__dirname, "src/utils"),
"@pages": path.join(__dirname, "src/pages"),
"@services": path.join(__dirname, "src/services"),
"@store": path.join(__dirname, "src/store"),
"@hooks": path.join(__dirname, "src/hooks"),
"@ability":path.join(__dirname, "src/ability")
}),
fixBabelImports("import", {
libraryName: "antd",
libraryDirectory: "es",
style: true,
})
);
module.exports.jest = aliasJest(aliasMap);