I installed the react app using npm's vite@latest command
npm create vite@latest my-portfolio -- --template react
Then I installed the tailwind css using below command inside my-portfolio/ directory
npm install -D tailwindcss postcss autoprefixer
Since npx tailwindcss init -p doesn’t work as my React v19, I manually created these files:
tailwind.config.js
export default {
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {},
},
plugins: [],
};
postcss.config.js
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
Also added CSS lines in src/index.css
@tailwind base;
@tailwind components;
@tailwind utilities;
After I run the npm run dev command I get this below error
[plugin:vite:css] [postcss] It looks like you're trying to use
tailwindcssdirectly as a PostCSS plugin. The PostCSS plugin has moved to a separate package, so to continue using Tailwind CSS with PostCSS you'll need to install@tailwindcss/postcssand update your PostCSS configuration.
