feat(examples): add Next.js 16 + Turbopack example (fixes silent unstyled-CSS trap)#4268
Draft
josephfarina wants to merge 1 commit into
Draft
feat(examples): add Next.js 16 + Turbopack example (fixes silent unstyled-CSS trap)#4268josephfarina wants to merge 1 commit into
josephfarina wants to merge 1 commit into
Conversation
Turbopack (the default bundler in Next.js 16) only links CSS reached through the JS module graph. The documented `@import '@astryxdesign/core/astryx.css'` from globals.css is compiled into a chunk but never linked onto the route, so components render unstyled with no error. The existing Next.js examples are all webpack-based and don't cover this. This adds a validated Next.js 16 + Turbopack example that imports the Astryx stylesheets as JS side-effects in the root layout (the supported path), with a README documenting the rule and the silent-failure it avoids.
josephfarina
requested review from
cixzhang,
ejhammond and
imdreamrunner
as code owners
July 23, 2026 20:47
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
July 23, 2026 20:48
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
josephfarina
marked this pull request as draft
July 24, 2026 00:00
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.
Problem
On Next.js 16 with Turbopack (the default bundler), the documented CSS setup
silently produces unstyled components. Importing the component stylesheet
via a CSS
@import:compiles the stylesheet into a chunk in
.next/static/chunks, but Turbopacknever links that chunk onto the route — no
<link>is emitted, so none ofthe component atomic rules reach the browser. There is no build error and no
console warning; components just render unstyled.
Every existing Next.js example in this repo (
example-nextjs,example-nextjs-tailwind,example-nextjs-stylex,example-nextjs-source) iswebpack-based (
next dev/next build), so this path was never covered.Fix
Add a validated Next.js 16 + Turbopack example app that imports the Astryx
stylesheets as JS side-effects in the root layout — the path Turbopack
reliably links:
Turbopack builds its CSS graph from the JS module graph, so CSS imported by a
module is bundled and linked; a bare
@importof a package CSS subpath from aCSS file is not. This is a bundler behavior, not an Astryx bug — but it means
the supported adoption path on Turbopack is the module-import form.
The example mirrors
example-nextjs(same showcase page, same Theme/Linkprovider) and differs only in:
nexton 16.x with--turbopackfor bothdevandbuildlayout.tsxinstead of@importinglobals.cssVerification
next build --turbopack(Next.js 16.2.11): compiles successfully;the component stylesheet is emitted as a chunk containing the full atomic rule
set (~1,500 rules).
<link rel="stylesheet">for that chunk and components render styled — the@import-from-CSS form emits the same chunk with no<link>.Follow-ups (not in this PR)
astryx doctorcheck that flags whenastryx.cssis only reachable via aCSS
@importon a Turbopack project.example.