This repository has been archived by the owner on Jun 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config-overrides.js
67 lines (63 loc) · 1.67 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const { resolve } = require('path')
const {
override,
addDecoratorsLegacy,
addBabelPlugins,
fixBabelImports,
addLessLoader,
addWebpackAlias,
} = require('customize-cra')
const WebpackBar = require('webpackbar')
const { getThemeVariables } = require('antd/dist/theme')
const addPlugins = () => (config) => {
config.plugins.push(
new WebpackBar({
color: '#69c0ff',
name: '❖',
})
)
Object.assign(config, {
optimization: {
...config.optimization,
namedModules: true,
namedChunks: true,
splitChunks: {
...config.optimization.splitChunks,
cacheGroups: { default: false },
},
},
})
return config
}
module.exports = override(
addDecoratorsLegacy(),
...addBabelPlugins(
'@babel/plugin-transform-spread',
['@babel/plugin-proposal-class-properties', { loose: true }],
'@babel/plugin-syntax-dynamic-import',
['@babel/plugin-proposal-pipeline-operator', { proposal: 'minimal' }],
['@babel/plugin-proposal-optional-chaining', { loose: false }],
'@babel/plugin-proposal-logical-assignment-operators',
'@babel/plugin-proposal-do-expressions',
...(process.env.REMOVE_CONSOLE ? [['transform-remove-console', { exclude: ['error', 'warn'] }]] : [])
),
fixBabelImports('import', {
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
}),
addLessLoader({
javascriptEnabled: true,
options: {
modifyVars: getThemeVariables({
dark: true, // enable dark mode
compact: true, // enable compact mode
}),
javascriptEnabled: true,
},
}),
addWebpackAlias({
'@layouts': resolve(__dirname, './src/layouts'),
}),
addPlugins()
)