-
Notifications
You must be signed in to change notification settings - Fork 2
/
config-overrides.js
46 lines (44 loc) · 1.29 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
const {
override,
addLessLoader,
adjustStyleLoaders,
} = require('customize-cra');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
module.exports = override(
// access webpack configuration
addLessLoader((loaderOptions) => {
const lessLoaderOptions = loaderOptions.lessOptions || {};
return {
lessOptions: {
...lessLoaderOptions,
javascriptEnabled: true,
modifyVars: {
'@primary-color': '#D64550',
'@link-color': '#D64550',
},
},
};
}),
adjustStyleLoaders(({ use: [, , postcss] }) => {
const postcssOptions = postcss.options;
postcss.options = { postcssOptions };
}),
(config, env) => {
// ignore minicssextractplugin
if (env === 'development') {
config.plugins.forEach(plugin => {
if (plugin instanceof MiniCssExtractPlugin) {
plugin.options.ignoreOrder = true;
}
});
}
config.resolve.plugins = config.resolve.plugins.filter(plugin => !(plugin instanceof ModuleScopePlugin));
// include polyfill
config.resolve.fallback = {
path: require.resolve('path-browserify'),
querystring: require.resolve('querystring-es3'),
};
return config;
}
);