Skip to content

Commit 741565a

Browse files
committed
Use different postcss plugins for tailwind
1 parent da22230 commit 741565a

File tree

1 file changed

+31
-17
lines changed

1 file changed

+31
-17
lines changed

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

+31-17
Original file line numberDiff line numberDiff line change
@@ -140,23 +140,37 @@ module.exports = function (webpackEnv) {
140140
// Necessary for external CSS imports to work
141141
// https://github.com/facebook/create-react-app/issues/2677
142142
ident: 'postcss',
143-
plugins: [
144-
'postcss-flexbugs-fixes',
145-
[
146-
'postcss-preset-env',
147-
{
148-
autoprefixer: {
149-
flexbox: 'no-2009',
150-
},
151-
stage: 3,
152-
},
153-
],
154-
// Adds PostCSS Normalize as the reset css with default options,
155-
// so that it honors browserslist config in package.json
156-
// which in turn let's users customize the target behavior as per their needs.
157-
'postcss-normalize',
158-
useTailwind && require('tailwindcss'),
159-
],
143+
config: false,
144+
plugins: !useTailwind
145+
? [
146+
'postcss-flexbugs-fixes',
147+
[
148+
'postcss-preset-env',
149+
{
150+
autoprefixer: {
151+
flexbox: 'no-2009',
152+
},
153+
stage: 3,
154+
},
155+
],
156+
// Adds PostCSS Normalize as the reset css with default options,
157+
// so that it honors browserslist config in package.json
158+
// which in turn let's users customize the target behavior as per their needs.
159+
'postcss-normalize',
160+
]
161+
: [
162+
'tailwindcss',
163+
'postcss-flexbugs-fixes',
164+
[
165+
'postcss-preset-env',
166+
{
167+
autoprefixer: {
168+
flexbox: 'no-2009',
169+
},
170+
stage: 3,
171+
},
172+
],
173+
],
160174
},
161175
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
162176
},

0 commit comments

Comments
 (0)