Skip to content

Commit 19faf8c

Browse files
author
Morten N.O. Henriksen
committed
Fix post css config
1 parent 74ed0c7 commit 19faf8c

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

packages/react-scripts/config/webpack.config.js

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin'
3434
// @remove-on-eject-begin
3535
const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
3636
// @remove-on-eject-end
37-
const postcssNormalize = require('postcss-normalize');
3837
const createEnvironmentHash = require('./webpack/persistentCache/createEnvironmentHash');
3938

4039
// Source maps are resource heavy and can cause out of memory issue for large source files.
@@ -124,22 +123,27 @@ module.exports = function (webpackEnv) {
124123
// package.json
125124
loader: require.resolve('postcss-loader'),
126125
options: {
127-
// Necessary for external CSS imports to work
128-
// https://github.com/facebook/create-react-app/issues/2677
129-
ident: 'postcss',
130-
plugins: () => [
131-
require('postcss-flexbugs-fixes'),
132-
require('postcss-preset-env')({
133-
autoprefixer: {
134-
flexbox: 'no-2009',
135-
},
136-
stage: 3,
137-
}),
138-
// Adds PostCSS Normalize as the reset css with default options,
139-
// so that it honors browserslist config in package.json
140-
// which in turn let's users customize the target behavior as per their needs.
141-
postcssNormalize(),
142-
],
126+
postcssOptions: {
127+
// Necessary for external CSS imports to work
128+
// https://github.com/facebook/create-react-app/issues/2677
129+
ident: 'postcss',
130+
plugins: [
131+
'postcss-flexbugs-fixes',
132+
[
133+
'postcss-preset-env',
134+
{
135+
autoprefixer: {
136+
flexbox: 'no-2009',
137+
},
138+
stage: 3,
139+
},
140+
],
141+
// Adds PostCSS Normalize as the reset css with default options,
142+
// so that it honors browserslist config in package.json
143+
// which in turn let's users customize the target behavior as per their needs.
144+
'postcss-normalize',
145+
],
146+
},
143147
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
144148
},
145149
},

0 commit comments

Comments
 (0)