Skip to content

Fix race condition in Next.js with --turbopack #17514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 3, 2025
Merged

Conversation

RobinMalfait
Copy link
Member

@RobinMalfait RobinMalfait commented Apr 2, 2025

This PR fixes an issue where if you use Next.js with --turbopack a race condition happens because the @tailwindcss/postcss plugin is called twice in rapid succession.

The first call sees an update and does a partial update with the new classes. Next some internal mtimes are updated. The second call therefore doesn't see any changes anymore because the mtimes are the same, therefore it's serving its stale data.

Fixes: #17508

Processing CSS files with only @tailwind utilities;

While working on a unit test for this, we also noticed that the PostCSS client did nothing at all when the input css contained only the @tailwind utilities; directive. It turns out that this was a directive that was not being checked for in the fast-bail code so in this PR we also changed it to account for that.

Test plan

@RobinMalfait RobinMalfait force-pushed the fix/issue-17508 branch 2 times, most recently from 47ffb64 to 5372d27 Compare April 2, 2025 17:56
@philipp-spiess philipp-spiess marked this pull request as ready for review April 3, 2025 12:47
@philipp-spiess philipp-spiess requested a review from a team as a code owner April 3, 2025 12:47
@philipp-spiess philipp-spiess requested a review from a team as a code owner April 3, 2025 12:47
@philipp-spiess philipp-spiess merged commit 81a676f into main Apr 3, 2025
7 checks passed
@philipp-spiess philipp-spiess deleted the fix/issue-17508 branch April 3, 2025 15:07
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.

Tailwind CSS Not Updating Global Styles on Latest Version
3 participants