-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-overrides.js
44 lines (42 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
const {
addLessLoader,
addBabelPlugin,
override,
fixBabelImports,
useEslintRc,
} = require('customize-cra');
const rewireYAML = require('react-app-rewire-yaml');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
const PRODUCTION = process.env.NODE_ENV === 'production';
module.exports = override(
useEslintRc(),
addBabelPlugin(['babel-plugin-emotion', { sourceMap: true, autoLabel: true }]),
fixBabelImports('babel-plugin-import', {
libraryName: 'antd',
libraryDirectory: 'es',
style: 'css',
}),
fixBabelImports('lodash', {
libraryDirectory: '',
camel2DashComponentName: false,
}),
addLessLoader({
javascriptEnabled: true,
modifyVars: {
// https://github.com/ant-design/ant-design/blob/master/components/style/themes/default.less
'@primary-color': '#9BC4CB',
'@menu-bg': 'transparent',
'@menu-dark-bg': 'transparent',
'@menu-dark-item-active-bg': 'transparent',
},
}),
config => ({
...config,
plugins: config.plugins.concat([
new HardSourceWebpackPlugin({ environmentHash: { files: ['npm-shrinkwrap.json', '.env'] } }),
...(PRODUCTION ? [new BundleAnalyzerPlugin()] : []),
]),
}),
rewireYAML,
);