fix: switch to @tailwindcss/vite for Vite 8 compatibility#679
Conversation
… compatibility Vite 8 uses Rolldown which has a built-in postcss-import handler that intercepts `@import 'tailwindcss'` and tries to resolve it as a file path, causing ENOENT errors. Switching to the Vite plugin approach avoids this by handling Tailwind CSS processing directly in the Vite pipeline. - Replace @tailwindcss/postcss with @tailwindcss/vite in package.json - Add tailwindcss() plugin to vite.config.ts - Remove postcss.config.js (no longer needed) https://claude.ai/code/session_01NrZ2h3jXqwAzd1Mx1Und4f
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughReplaces PostCSS-based Tailwind setup with the Vite Tailwind plugin, removes Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@package.json`:
- Line 33: Update the `@tailwindcss/vite` dependency version to a release that
supports Vite 8 (e.g., change "@tailwindcss/vite": "^4.1.8" to "^4.2.2" or
later) in package.json, then reinstall dependencies (npm/yarn/pnpm) to refresh
the lockfile and verify the project builds/tests with Vite ^8.0.0; ensure any
references to "@tailwindcss/vite" in tooling config remain compatible after the
upgrade.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: df721ead-8721-4834-9e2f-e2dc777d6d10
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
package.jsonpostcss.config.jsvite.config.ts
💤 Files with no reviewable changes (1)
- postcss.config.js
The vite-plugin-svelte v7 upgrade broke the build but was automerged because the Check and test job never ran `npm run build`. Adding it ensures build failures are caught before merge. https://claude.ai/code/session_01NrZ2h3jXqwAzd1Mx1Und4f
@tailwindcss/vite 4.1.x only supports vite ^5.2.0 || ^6 || ^7. Vite 8 support was added in 4.2.2 via tailwindlabs/tailwindcss#19790. https://claude.ai/code/session_01NrZ2h3jXqwAzd1Mx1Und4f
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 43-44: The CI build job is invoking the general "npm run build"
which triggers "prisma migrate deploy" and mutates the DB; change the workflow
to call a migration-free build script (e.g., replace "npm run build" with "npm
run build:ci" in the job) and add a package.json script "build:ci" that runs
only generation and bundling (e.g., use "prisma generate" and "vite build"
instead of migrations); keep any "prisma migrate deploy" calls confined to a
separate controlled job/environment that runs migrations explicitly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6ecb0ee0-1b37-4ec2-83f2-fc54ae03d1d7
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
.github/workflows/ci.ymlpackage.json
🚧 Files skipped from review as they are similar to previous changes (1)
- package.json
`npm run build` now only generates Prisma client and runs vite build. `npm run build:migrate` adds prisma migrate deploy for environments that need DB migrations (e.g. Playwright test job). This prevents concurrent migration runs when the build and test CI jobs execute in parallel against the same database. https://claude.ai/code/session_01NrZ2h3jXqwAzd1Mx1Und4f
Summary\n- Production deployments have been failing since Vite 8 was merged (PR #656). Vite 8 uses Rolldown, whose built-in
postcss-importhandler intercepts@import 'tailwindcss'and tries to resolve it as a literal file path, causingENOENTerrors.\n- Switches from@tailwindcss/postcssto@tailwindcss/vite(the recommended approach for Tailwind v4 + Vite) and removes the now-unnecessarypostcss.config.js.\n\n## Test plan\n- [ ] Verifyvite buildsucceeds without the PostCSS ENOENT error\n- [ ] Verify production deployment completes successfully\n- [ ] Verify Tailwind styles render correctly in the deployed app\n\nhttps://claude.ai/code/session_01NrZ2h3jXqwAzd1Mx1Und4fSummary by CodeRabbit