From eac07fb755a3cdd06242f68be8de5fd14096b0f5 Mon Sep 17 00:00:00 2001
From: await-ovo <13152410380@163.com>
Date: Tue, 12 Apr 2022 01:04:57 +0800
Subject: [PATCH] fix(react-scripts): use react-scripts' own postcss
 dependencies

---
 packages/react-scripts/config/webpack.config.js | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js
index 2b1b3bbd4..ea13a1635 100644
--- a/packages/react-scripts/config/webpack.config.js
+++ b/packages/react-scripts/config/webpack.config.js
@@ -135,6 +135,7 @@ module.exports = function (webpackEnv) {
         // Adds vendor prefixing based on your specified browser support in
         // package.json
         loader: require.resolve('postcss-loader'),
+        implementation: require.resolve("postcss"),
         options: {
           postcssOptions: {
             // Necessary for external CSS imports to work
@@ -143,9 +144,9 @@ module.exports = function (webpackEnv) {
             config: false,
             plugins: !useTailwind
               ? [
-                  'postcss-flexbugs-fixes',
+                  require('postcss-flexbugs-fixes'),
                   [
-                    'postcss-preset-env',
+                    require('postcss-preset-env'),
                     {
                       autoprefixer: {
                         flexbox: 'no-2009',
@@ -156,13 +157,13 @@ module.exports = function (webpackEnv) {
                   // Adds PostCSS Normalize as the reset css with default options,
                   // so that it honors browserslist config in package.json
                   // which in turn let's users customize the target behavior as per their needs.
-                  'postcss-normalize',
+                  require('postcss-normalize'),
                 ]
               : [
-                  'tailwindcss',
-                  'postcss-flexbugs-fixes',
+                  require('tailwindcss'),
+                  require('postcss-flexbugs-fixes'),
                   [
-                    'postcss-preset-env',
+                    require('postcss-preset-env'),
                     {
                       autoprefixer: {
                         flexbox: 'no-2009',
-- 
GitLab