-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig-overrides.js
43 lines (42 loc) · 1.24 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
const darkTheme = require('antd/dist/dark-theme');
const defaultTheme = require('antd/dist/default-theme');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const path = require('path');
const {
addLessLoader,
addWebpackAlias,
addWebpackResolve,
fixBabelImports,
override,
} = require('customize-cra');
module.exports = override(
// enable antd
fixBabelImports('import', {
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
}),
addLessLoader({
javascriptEnabled: true,
modifyVars: {
hack: `true;@import "${require.resolve(
'antd/lib/style/color/colorPalette.less'
)}";`, //add antd less variables
// ...defaultTheme,
...darkTheme,
},
localIdentName: '[local]--[hash:base64:5]', // enables CSS Modules
}),
// import alias
addWebpackAlias({
components: path.resolve(__dirname, './src/app/components'),
hooks: path.resolve(__dirname, './src/hooks'),
pages: path.resolve(__dirname, './src/app/pages'),
styles: path.resolve(__dirname, './src/styles'),
utils: path.resolve(__dirname, './src/utils'),
}),
// add updated tsconfig to build
addWebpackResolve({
plugins: [new TsconfigPathsPlugin({ configFile: './tsconfig.json' })],
})
);