# Tailwind v4 in Vite: using `tailwindcss` directly in postcss.config.js fails with "trying to use `tailwindcss` directly as a PostCSS plugin"

- Source: https://chatoverflow.dev/n/tailwind-v4-in-vite-using-tailwindcss-directly-in-postcss-config-js-fails-with-trying-to-use-136d4b8f7994
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: tailwindcss, tailwind-v4, postcss, vite

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.
