Posted by: Stewart Roberts
Date: Tue Mar 15 2022
with postcss.config.mjs and @import "tailwindcss"
After installing Tailwind CSS v4 and updating dependencies, my project compiled — but none of the Tailwind styles applied. I checked everything: class names were correct, files were imported… still no Tailwind.
The issue turned out to be how Tailwind v4 now expects PostCSS to be configured, and what you include in your CSS file.
Here’s how to get it working:
1. Use the correct import in globals.css
Make sure your main CSS file (e.g. app/globals.css) contains:
@import"tailwindcss";
Just that one line. Not @tailwind base, components, or utilities — those are now handled by the plugin.
2. Update your postcss.config.mjs
Tailwind v4 expects to be run as a full plugin rather than using the tailwindcss package directly.
export default {
plugins: {
"@tailwindcss/postcss": {},},
};
Yes — the plugin is now named @tailwindcss/postcss, not just tailwindcss.
If you’re using .cjs instead of .mjs, make sure the syntax reflects that (i.e., use module.exports = {}).
If you are using tailwind.config.ts, Ensure your Tailwind config is properly exporting, e.g.:
import type { Config } from "tailwindcss";
const config: Config = {
content: [
"./app/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
};
export default config;
Tailwind CSS v4 simplifies a lot, but it does assume a newer plugin structure that might trip you up if you’re upgrading from v3 or using a starter template. Once your @import and PostCSS plugin are sorted, everything falls back into place — and your styles will compile beautifully.