Skip to content

astro add tailwind installs incompatible @tailwindcss/vite (build fails on Astro 6 default rolldown-vite) #16542

Description

@FunksterOne

What version of astro are you using?

6.2.1 (with bundled vite 7.3.2)

What package manager are you using?

npm

What operating system are you using?

Windows 11 (also seen on macOS — see related vitejs/vite#22322)

Describe the Bug

Running astro add tailwind (the documented way to install Tailwind per the AI tools guide and integration docs) on a fresh Astro 6 project installs @tailwindcss/vite@^4.2.4 and registers it as a Vite plugin. The resulting setup fails to build:

[ERROR] [vite] ✗ Build failed in 1.10s
[@tailwindcss/vite:generate:build] Missing field `tsconfigPaths` on BindingViteResolvePluginConfig.resolveOptions
file: src/styles/global.css
  Stack trace:
    at makeBuiltinPluginCallable (file:///.../node_modules/rolldown/dist/shared/normalize-string-or-regex-...)
    at oxcResolvePlugin (file:///.../node_modules/vite/dist/node/chunks/node.js)
    at @tailwindcss/vite/dist/index.mjs

This is the same root cause as vitejs/vite#22322, where the original reporter concluded it is an Astro-side issue rather than Vite. As of the date this is filed, no corresponding issue exists in this repo.

What's the expected result?

astro add tailwind should produce a working setup — either by installing the PostCSS variant (@tailwindcss/postcss) when rolldown-vite is in use, or by warning the user.

What's the actual result?

astro add tailwind succeeds and modifies config, but npm run build then fails immediately on any Tailwind-using stylesheet.

Reproduction

npm create astro@latest demo -- --template minimal --typescript strict --yes
cd demo
npm install
npx astro add tailwind --yes
mkdir -p src/styles
echo '@import "tailwindcss";' > src/styles/global.css
cat > src/pages/index.astro <<'EOA'
---
import "../styles/global.css";
---
<div class="text-blue-500">hi</div>
EOA
npm run build

Workarounds

Option 1 — switch to PostCSS:

npm uninstall @tailwindcss/vite
npm install @tailwindcss/postcss

postcss.config.mjs:

export default { plugins: { "@tailwindcss/postcss": {} } };

astro.config.mjs: remove the @tailwindcss/vite plugin.

This builds fine.

Option 2 — pin Vite to v6 (per miksin/dev-log#34).

Suggested fix

Either:

  1. Update astro add tailwind to install @tailwindcss/postcss and write postcss.config.mjs instead of @tailwindcss/vite, until the latter supports the rolldown-bundled Vite that Astro 6 ships with.
  2. Detect the incompatibility during astro add tailwind and print a warning + recommendation.

Versions tested

  • astro@6.2.1
  • @tailwindcss/vite@4.2.4
  • tailwindcss@4.2.4
  • vite@7.3.2 (transitive via Astro)

Related

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions