Skip to content

feat: support tailwind v4 #28939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ export async function getStylesConfig(wco: WebpackConfigOptions): Promise<Config
extraPostcssPlugins.push(require(tailwindPackagePath)({ config: tailwindConfigPath }));
}
}
// Check for tailwind V4
// Tailwind V4 uses the new `@tailwindcss/postcss` package
try {
const tailwindPostCSSPackagePath = require.resolve('@tailwindcss/postcss', { paths: [root] });
try {
require.resolve('tailwindcss', { paths: [root] });
// Tailwind V4 is installed, add the plugin
extraPostcssPlugins.push(require(tailwindPostCSSPackagePath)());
} catch {
logger.warn(
`The '@tailwindcss/postcss' package is installed but the 'tailwindcss' package is not installed.` +
` To enable Tailwind CSS, please install the 'tailwindcss' package.`,
);
}
} catch {
// Tailwind V4 is not installed, no further action is needed
}

const autoprefixer: typeof import('autoprefixer') = require('autoprefixer');

Expand Down