Skip to content

Ignore Vite build output when scanning sources - #20484

Open
OllieinCanada wants to merge 2 commits into
tailwindlabs:mainfrom
OllieinCanada:codex/issue-17412
Open

Ignore Vite build output when scanning sources#20484
OllieinCanada wants to merge 2 commits into
tailwindlabs:mainfrom
OllieinCanada:codex/issue-17412

Conversation

@OllieinCanada

@OllieinCanada OllieinCanada commented Sep 11, 2026

Copy link
Copy Markdown

Summary

  • Exclude Vite's resolved build output directory from Tailwind's native content scanner during builds.
  • Prevent existing generated assets from becoming watch dependencies and triggering an infinite vite build --watch loop.
  • Preserve explicitly configured @source files beneath the output directory.
  • Preserve normal watch behavior for real source changes.
  • Add a packed-consumer regression using exact vite@6.2.3, a custom assets output directory, emptyOutDir: false, and artifacts from a previous build.

Fixes #17412.

Test plan

pnpm --filter @tailwindcss/vite build
pnpm exec prettier --check packages/@tailwindcss-vite/src/index.ts integrations/vite/build-watch.test.ts
pnpm exec vitest run --root=./integrations vite/build-watch.test.ts
pnpm exec vitest run --root=./integrations vite/index.test.ts -t "watch mode"

The packed-artifact regression was also checked against an unmodified current-main tarball. The baseline enters a second build immediately after the first; the candidate remains idle, honors an explicit source inside the output directory, then rebuilds normally after editing a real source file. Swapping back to the baseline makes the same test fail again.

@OllieinCanada
OllieinCanada requested a review from a team as a code owner September 11, 2026 14:44
@greptile-apps

greptile-apps Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the prior explicit-source regression is resolved without reintroducing the automatic build-output watch loop.

Reviews (2) · Last reviewed commit: "Preserve explicit sources in Vite output"

Comment thread packages/@tailwindcss-vite/src/index.ts
@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 38d2b837-bbd9-49b8-8895-4bd7bdca51fe

📥 Commits

Reviewing files that changed from the base of the PR and between 3bfba3b and c9a445e.

📒 Files selected for processing (2)
  • integrations/vite/build-watch.test.ts
  • packages/@tailwindcss-vite/src/index.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


Walkthrough

The Vite plugin passes the resolved build output directory to Root. Automatic source detection excludes files under that directory. Explicit @source paths use a separate scanner and remain available for candidate and watch dependency processing. A new integration test verifies that vite build --watch stays idle after the initial build and rebuilds after a source file changes.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to c9a44

The change excludes generated output from automatic scanning while retaining explicit source scanning and watch rebuilds.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #17412 requires vite build --watch to avoid rebuilds caused by generated output and to rebuild after source changes. The Vite plugin resolves config.build.outDir during builds and adds a neg…
Out of Scope Changes check ✅ Passed The changes stay within Issue #17412. The source changes exclude Vite-generated output from automatic Tailwind scanning and preserve explicitly requested sources. The added test covers the reported Vi…
Title check ✅ Passed The title clearly summarizes the primary change: excluding Vite build output from source scanning.
Description check ✅ Passed The description directly explains the source-scanning change, watch-loop prevention, explicit @source behavior, regression test, and linked issue.

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.

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.

[v4.0.17] Infinite rebuild loop with vite build --watch, fixed in v4.0.6

1 participant