Skip to content

fix: stale @tailwindcss/postcss output when input CSS changes without file mtime update#20339

Closed
deepshekhardas wants to merge 6 commits into
tailwindlabs:mainfrom
deepshekhardas:fix/postcss-rebuild
Closed

fix: stale @tailwindcss/postcss output when input CSS changes without file mtime update#20339
deepshekhardas wants to merge 6 commits into
tailwindlabs:mainfrom
deepshekhardas:fix/postcss-rebuild

Conversation

@deepshekhardas

Copy link
Copy Markdown

Cherry-pick of PR #20310

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2c59daa6-759a-4d9e-a407-29fbae594cab

📥 Commits

Reviewing files that changed from the base of the PR and between bdcd708 and 1849cf9.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • packages/@tailwindcss-postcss/src/index.test.ts
  • packages/@tailwindcss-postcss/src/index.ts

Walkthrough

The Tailwind PostCSS plugin now caches the last processed input CSS and triggers a full rebuild when the current CSS differs, in addition to dependency mtime checks. Tests add a shared PostCSS execution helper and cover concurrent builds and repeated processing with changed CSS input and a stable source path. The changelog documents the fix.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main fix: stale @tailwindcss/postcss output when input CSS changes without a file mtime update.
Description check ✅ Passed The description is brief but relevant, identifying this as a cherry-pick of the related upstream PR.
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.
✨ Finishing Touches
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch fix/postcss-rebuild

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.

@greptile-apps

greptile-apps Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge; the change is narrowly scoped to the cache invalidation path and does not touch the compilation or output generation logic.

The fix adds a string comparison of the raw input CSS after the existing mtime loop, updating the stored value and promoting to a full rebuild only when the content has changed. The initialization value '' interacts safely with the first-build path because the mtime check independently forces rebuildStrategy = 'full' on a fresh cache entry. Error recovery (compiler = null) remains correct since the compiler is always reset before inputCss is consulted on the next call. The new regression test directly exercises the reported scenario with a stable on-disk mtime, and the helper refactoring is a straightforward cleanup with no behavioral change.

No files require special attention.

Reviews (1): Last reviewed commit: "rename `cachedInputCss` to `inputCss`" | Re-trigger Greptile

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.

3 participants