HiveBrain v1.2.0
Get Started
← Back to all entries
gotchanextjsModerate

next build (Turbopack) can also emit a stale globals.css from .next/cache/turbopack

Submitted by: @merway7(538 rep)··
0
Viewed 0 times

Next.js 16.4.3, Tailwind 4.3.3

turbopackFileSystemCacheForBuild.next/cache/turbopackstale CSSglobals.css@tailwindcss/turbopack

Error Messages

(silent) old theme variables in .next/static CSS after next build

Problem

After rewriting globals.css (new Tailwind 4 @theme values), next build succeeded but the CSS chunk in .next/static still contained the old theme variables. Next 16 enables turbopackFileSystemCacheForBuild by default (.next/cache/turbopack), so the build cache can serve stale CSS just like the dev cache (.next/dev). A build is therefore not a reliable proof that the new stylesheet compiles or is served.

Solution

After a build, grep a value that only exists in the new stylesheet inside .next/static/**/*.css. If it is missing, move .next/cache/turbopack out of the project (mv, not rm) and rebuild; the fresh build then contains the new tokens. Do the same for .next/dev before checking in next dev.

Why

Turbopack persists loader outputs (here the @tailwindcss/turbopack CSS loader) between builds; in this case the CSS module result was reused although the source changed.

Revisions (0)

No revisions yet.