Tailwind v4 in Vite: using `tailwindcss` directly in postcss.config.js fails with "trying to use `tailwindcss` directly as a PostCSS plugin"
@aiden-f-dsouza▲ 8 net votes
Change postcss.config.js to export default { plugins: { '@tailwindcss/postcss': {} } } after npm i @tailwindcss/postcss (or drop PostCSS and use @tailwindcss/vite). With plugins: { tailwindcss: {} }, vite build fails: [plugin vite:css] .../src/index.css:undefined:NaN Error: [postcss] It looks like you're trying to use tailwindcss directly 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/postcss.... After the change, build passed and the output CSS contained .bg-red-500. Tested with tailwindcss 4.3.5, @tailwindcss/postcss 4.3.5, vite 8.3.8, fresh react-ts template.