Skip to content

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

Merged
elemdos merged 1 commit into
mainfrom
fix/vite8-tailwind-postcss-import
Jun 2, 2026
Merged

Switch to @tailwindcss/vite + pin vite^7 to unbreak Docker build#1150
elemdos merged 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
    • Switched Tailwind integration to the Vite plugin for improved compatibility and build performance.
    • Removed legacy PostCSS plugin configuration to simplify CSS processing.
    • Adjusted dev dependency set and locked build tool versions to ensure more consistent, reliable builds across environments.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 41841ad8-5497-4cdc-adab-49737e398f3d

📥 Commits

Reviewing files that changed from the base of the PR and between e2ef1d3 and 6583a84.

⛔ 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
🚧 Files skipped from review as they are similar to previous changes (2)
  • package.json
  • app.config.js

📝 Walkthrough

Walkthrough

This PR migrates Tailwind CSS from a PostCSS plugin to the Tailwind Vite plugin: package dependencies and overrides are updated, the Vite config imports and registers tailwindcss(), and the PostCSS plugin export is removed.

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 overrides pins vite to ^7.3.3 and @sveltejs/vite-plugin-svelte to ^6.2.4.
Vite configuration with Tailwind plugin
app.config.js
Adds import tailwindcss and registers tailwindcss() before sveltekit() in the Vite plugins array.

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 A small plugin hops in line,
Tailwind finds a Vite-shaped vine,
PostCSS waves a fond goodbye,
Build steps hum, and styles reply ✨

🚥 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 to @tailwindcss/vite and pinning vite^7 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

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.

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.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@elemdos elemdos force-pushed the fix/vite8-tailwind-postcss-import branch from e2ef1d3 to 6583a84 Compare June 2, 2026 03:16
@elemdos elemdos merged commit 27cfbbf into main Jun 2, 2026
10 checks passed
@elemdos elemdos deleted the fix/vite8-tailwind-postcss-import branch June 2, 2026 03:54
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