Skip to content

Commit 21dcf73

Browse files
committed
Remove tailwindcss dependency
Fixes facebook#12044 Installing tailwindcss comes with a bunch of junk most people don't need, and at least prettier-plugin-tailwindcss but possibly more subdependecies are unlicensed which makes usage troublesome.
1 parent 428ddb6 commit 21dcf73

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

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

+11-3
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,18 @@ const imageInlineSizeLimit = parseInt(
6868
// Check if TypeScript is setup
6969
const useTypeScript = fs.existsSync(paths.appTsConfig);
7070

71+
const hasTailwindcss = (() => {
72+
try {
73+
require.resolve('tailwindcss');
74+
return true;
75+
} catch (e) {
76+
return false;
77+
}
78+
})();
7179
// Check if Tailwind config exists
72-
const useTailwind = fs.existsSync(
73-
path.join(paths.appPath, 'tailwind.config.js')
74-
);
80+
const useTailwind =
81+
hasTailwindcss &&
82+
fs.existsSync(path.join(paths.appPath, 'tailwind.config.js'));
7583

7684
// Get the path to the uncompiled service worker (if it exists).
7785
const swSrc = paths.swSrc;

packages/react-scripts/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
"semver": "^7.3.5",
7070
"source-map-loader": "^3.0.0",
7171
"style-loader": "^3.3.1",
72-
"tailwindcss": "^3.0.2",
7372
"terser-webpack-plugin": "^5.2.5",
7473
"webpack": "^5.64.4",
7574
"webpack-dev-server": "^4.6.0",

0 commit comments

Comments
 (0)