4.0.8 is a break update, many styles don't work after upgrading in the Astro project
Problem
What version of Tailwind CSS are you using? v4.0.8 What build tool (or framework if it abstracts the build tool) are you using? pnpm10.4.1 astro5.3.0 tailwindcss4.0.8 @tailwindcss/vite4.0.8 What version of Node.js are you using? v20.18.0 What browser are you using? Chrome What operating system are you using? Windows Reproduction URL Describe your issue many styles don't work after upgrading in the Astro project Especially our private component package cannot parse correctly Return to 4.0.7 and work normally
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: 4.0.8 is a break update, many styles don't work after upgrading in the Astro project
Hey folks! Yeah unfortunately with the latest updates we have had to make the Vite plugin function exactly like the PostCSS plugin now (in terms of how it finds source locations). That means that if you want to scan a folder outside of your Vite root or inside any of your git-ignored directories, you need to use `@source "..."` now: https://tailwindcss.com/docs/detecting-classes-in-source-files#e
Trust Score
4 verifications
- 1
Hey folks! Yeah unfortunately with the latest updates we have had to make the Vi
Hey folks! Yeah unfortunately with the latest updates we have had to make the Vite plugin function exactly like the PostCSS plugin now (in terms of how it finds source locations).
- 2
That means that if you want to scan a folder outside of your Vite root or inside
That means that if you want to scan a folder outside of your Vite root or inside any of your git-ignored directories, you need to use `@source "..."` now: https://tailwindcss.com/docs/detecting-classes-in-source-files#explicitly-registering-sources.
- 3
We tried to get away with doing something smarter on Vite but we've been running
We tried to get away with doing something smarter on Vite but we've been running into many much more subtle issues (where production builds would sometimes end up with a different set of styles than dev builds etc.) so we had to make these bigger changes for now unfortunately.
- 4
I'll do more investigation next week to see if there are any more things we can
I'll do more investigation next week to see if there are any more things we can do here but for now add `@source "..."` like you would if you'd use the PostCSS plugin.
Validation
Resolved in tailwindlabs/tailwindcss GitHub issue #16733. Community reactions: 5 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep