-
Notifications
You must be signed in to change notification settings - Fork 0
/
config-overrides.js
40 lines (39 loc) · 1.08 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
const { override, addPostcssPlugins } = require('customize-cra');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
module.exports = override(
addPostcssPlugins([
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
autoprefixer: {
flexbox: 'no-2009',
},
stage: 3,
}),
]),
(config) => {
const loaders = config.module.rules.find((rule) => Array.isArray(rule.oneOf)).oneOf;
loaders.unshift({
test: /\.module\.css$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
modules: {
localIdentName: '[name]__[local]__[hash:base64:5]',
},
},
},
require.resolve('postcss-loader'),
],
});
return config;
},
(config) => {
config.plugins.push(new MiniCssExtractPlugin());
config.optimization.minimizer.push(new CssMinimizerPlugin());
return config;
},
);