-
Notifications
You must be signed in to change notification settings - Fork 2
/
config-overrides.js
64 lines (61 loc) · 1.5 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
/* eslint-disable global-require */
const { resolve } = require('path')
const webpack = require('webpack')
const {
override,
addDecoratorsLegacy,
addBabelPlugins,
fixBabelImports,
addLessLoader,
addWebpackAlias
} = require('customize-cra')
const WebpackBar = require('webpackbar')
const addPlugins = () => config => {
config.plugins.push(
new WebpackBar({
color: '#faad14',
name: '❖'
}),
require('autoprefixer'),
new webpack.ProvidePlugin({
'window.less': 'less'
})
)
Object.assign(config, {
devtool: process.env.SOURCE_MAP ? 'source-map' : false,
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'
),
fixBabelImports('import', {
libraryName: 'antd',
libraryDirectory: 'es',
style: true
}),
addLessLoader({
javascriptEnabled: true,
modifyVars: { '@primary-color': '#3f51b5' }
}),
addWebpackAlias({
'@assets': resolve(__dirname, './src/assets'),
'@helpers': resolve(__dirname, './src/helpers'),
'@views': resolve(__dirname, './src/views'),
'@config': resolve(__dirname, './src/config')
}),
addPlugins()
)