Skip to content

Switch to @tailwindcss/vite + pin vite^7 to unbreak Docker build#1150

Open
elemdos wants to merge 1 commit into
mainfrom
fix/vite8-tailwind-postcss-import
Open

Switch to @tailwindcss/vite + pin vite^7 to unbreak Docker build#1150
elemdos wants to merge 1 commit into
mainfrom
fix/vite8-tailwind-postcss-import

Conversation

@elemdos
Copy link
Copy Markdown
Collaborator

@elemdos elemdos commented May 29, 2026

Summary

Docker image build has been broken for ~11 days; CI's main.yml fails at vite --config app.config.js build. Two vite 8 bugs are involved:

  1. postcss-import bare specifier resolution — vite 8's bundled postcss-import tries to read <projectRoot>/tailwindcss as a literal path instead of resolving @import 'tailwindcss'; from node_modules, producing ENOENT: no such file or directory, open '/app/tailwindcss'.
  2. lightningcss minify regression on Svelte scoped CSS — vite 8's default cssMinify is lightningcss, which rejects @keyframes blocks inside Svelte's nested-selector scoped CSS output.

Dependabot exposed both by bumping @sveltejs/kit 2.59.1 → 2.60.1, which let the transitive vite-plugin-svelte re-resolve from 6.x → 7.1.2 and pull in vite 8.

Fix

  • Replace @tailwindcss/postcss with @tailwindcss/vite (the canonical Tailwind v4 + Vite setup) so the Tailwind entry is resolved by Tailwind's own plugin and never touches vite's broken postcss-import.
  • Delete postcss.config.cjs (only contained the now-removed @tailwindcss/postcss entry; the postcss + postcss-nested deps are still used by runtime CSS workers, untouched).
  • Add npm overrides pinning vite ^7.3.3 + @sveltejs/vite-plugin-svelte ^6.2.4 to sidestep the lightningcss minify regression. Both are within @sveltejs/kit 2.60.1's declared peer ranges.

Verified locally: npx vite --config app.config.js build succeeds, produces a ~230KB Tailwind CSS bundle plus Svelte component CSS chunks.

Test plan

  • CI's main.yml workflow goes green on this branch
  • ghcr.io/primocms/primo:main rebuilds and the testing deploy picks it up

Summary by CodeRabbit

  • Chores
    • Updated Tailwind CSS integration to use the latest build tooling approach for improved compatibility and build performance.

Review Change Stack

Two bugs in vite 8 break the SvelteKit Docker build:

1. vite 8's bundled postcss-import can't resolve bare specifiers, so
   `@import 'tailwindcss';` errors with ENOENT for `/app/tailwindcss`.
2. vite 8 defaults cssMinify to lightningcss, which rejects @Keyframes
   inside Svelte's scoped CSS selectors.

Use @tailwindcss/vite (canonical Tailwind v4 + Vite setup) so the
Tailwind entry never touches vite's broken postcss-import. Pin vite to
^7.3.3 and vite-plugin-svelte to ^6.2.4 via npm overrides to dodge the
lightningcss minify regression until upstream lands a fix.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: af814aa8-ee7b-4b2d-9907-f4a31bbef216

📥 Commits

Reviewing files that changed from the base of the PR and between 6e9fe64 and e2ef1d3.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • app.config.js
  • package.json
  • postcss.config.cjs
💤 Files with no reviewable changes (1)
  • postcss.config.cjs

📝 Walkthrough

Walkthrough

This PR migrates Tailwind CSS configuration from a PostCSS-based setup to using the Tailwind Vite plugin. Dependencies are updated to use @tailwindcss/vite instead of @tailwindcss/postcss, version pins are added for build tool compatibility, and the Vite config is updated to register the new plugin. The PostCSS configuration file becomes unused.

Changes

Tailwind Vite Plugin Migration

Layer / File(s) Summary
Tailwind Vite dependency and version pins
package.json
@tailwindcss/postcss is replaced with @tailwindcss/vite (^4.3.0), and new overrides entries pin vite to ^7.3.3 and @sveltejs/vite-plugin-svelte to ^6.2.4.
Vite configuration with Tailwind plugin
app.config.js
Tailwind Vite plugin is imported and registered in the Vite plugins array, positioned before sveltekit().

🎯 1 (Trivial) | ⏱️ ~3 minutes

🐰 A vite plugin hops into place,
Tailwind sheds its PostCSS trace,
Versions pinned with care so tight,
Build config takes its final flight! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: switching from @tailwindcss/postcss to @tailwindcss/vite and pinning vite to v7 to fix Docker build failures.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/vite8-tailwind-postcss-import

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant