chore: use Tailwind Turbopack loader instead of PostCSS - #489
Merged
Conversation
Aligns the template and docs apps with the new create-next-app default from vercel/next.js#96606, which uses @tailwindcss/turbopack and a Turbopack CSS loader rule for Tailwind projects on the Turbopack path instead of routing CSS through PostCSS. - add the turbopack.rules CSS rule to both next.config.ts files - delete postcss.config.mjs from both apps - swap @tailwindcss/postcss for @tailwindcss/turbopack, drop postcss No globals.css changes are needed; @import "tailwindcss", the typography plugin, @theme inline, and tw-animate-css all work unchanged. Emitted CSS is byte-identical to the PostCSS output in both apps.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Aligns
apps/templateandapps/docswith the new create-next-app default from vercel/next.js#96606, which uses@tailwindcss/turbopackand a Turbopack CSS loader rule for Tailwind projects on the Turbopack path, avoiding the PostCSS setup. (@tailwindcss/postcss+postcss.config.mjsremain the upstream default only for non-Turbopack bundlers.)Today CSS takes a detour — Turbopack spins up a Node worker, parses to a PostCSS AST, and hands Tailwind a string it already knows how to compile. The dedicated loader skips that hop and calls Tailwind's engine directly.
Per app:
turbopack.rulesCSS rule tonext.config.ts, matching the shape create-next-app now generatespostcss.config.mjs@tailwindcss/postcss→@tailwindcss/turbopack@4.3.3and drop the now-unusedpostcssdepNo
globals.csschanges are needed.@import "tailwindcss",@plugin '@tailwindcss/typography',@theme inline, andtw-animate-cssall work unchanged, and nopostcssreferences remain outside the lockfile.Verification
pnpm exec next buildinapps/template→ exit 0pnpm exec next buildinapps/docs→ exit 0.bg-shop{background-color:#5a31f4}(the@theme inlinetoken),prose(typography plugin),animate-in(tw-animate-css), and the docsfd-/shop-homescopes.next dev→GET / 200, stylesheet served unminified at 149,386 bytes with.bg-shop,.hover\:bg-shop\/85:hover, and.cursor-pointerpresent.pnpm linttemplate → 0 warnings, 0 errors, formatting cleanpnpm lintdocs → 0 errors, 1 pre-existingno-img-elementwarning inapp/[lang]/og/[...slug]/route.tsx(untouched, Satori-required)pnpm typecheckdocs → cleanBuild times are within noise (~10s cold both ways) on these apps; Tailwind's ~2x number is CSS-compile-time in isolation, which isn't the bottleneck here. The reason to land this is staying on the Next.js default path.
Notes
.changeset/config.jsonignorestemplateanddocs.apps/docs/content/docs/documents the CSS pipeline today, so there's no doc page to update. Worth deciding separately whether the styling setup should get one now that it diverges from the@tailwindcss/postcsssetup most people expect.