Do we need the CRACO module in the new tailwindcss version 3?

Viewed 574

As I updated tailwindcss to version 3, I was following an old tutorial for the use of tailwindcss on frameworks like react when I realised that the teacher was creating and setting up their own craco.config.js file.

When I checked the Documentation for the new tailwind version, It seemed like the CRACO set up step has been completely forgotten.

So my question is, Do we really need CRACO in tailwind 3 ?

1 Answers

Tailwindcss v3 only supports Postcss8 and only create-react-app v5 supports Postcss8 for now. So you need to upgrade the create-react-app to v5. No need for craco in create-react-app v5 as well

First make sure to checkout to different branch or push your code to github before migrating, just for safety.

1.First run npm uninstall @craco/craco autoprefixer postcss tailwindcss Delete the craco.config.js file Delete the tailwind.config.js Now just follow the offical tailwindcss docs

  1. Run npm install -D tailwindcss postcss autoprefixer

  2. npx tailwindcss init -p copy paste the tailwind.config.js file from tailwindcss docs

  3. npm install react-scripts@latest

  4. Now npm start

Later paste your previous tailwind.config theme in the new tailwind.config.js file.

The order of steps may or may not matter but following this steps worked for me.

Related