Skip to content

Migrate Next StyleX example to Turbopack - #6840

Closed
cixzhang wants to merge 4 commits into
mainfrom
feat/next-stylex-migration
Closed

cixzhang wants to merge 4 commits into
mainfrom
feat/next-stylex-migration

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • migrate the StyleX Next.js example to Next 16.3.6 Turbopack and the official StyleX 0.19.1 Babel + PostCSS path
  • consume published, precompiled Astryx reset/base/theme CSS with a dedicated cascade-layer order and product p namespace
  • add fail-closed published-package, source-boundary, duplicate-rule, class-prefix, CSS-size, and layer-order guards
  • cover production, two routes, server/client composition, HMR add/change/remove, and desktop/mobile light/dark rendering in CI

Known limitation

The official PostCSS integration emits one app-wide StyleX sheet from every matched product file. It does not provide route-level or import-graph CSS tree shaking.

Test plan

  • pnpm check:repo
  • targeted ESLint and Prettier checks
  • standalone pnpm build (Next.js 16.3.6 Turbopack)
  • pnpm check:stylex
  • negative controls for wrong layer order, x-prefixed product leakage, and duplicate Astryx CSS
  • CI browser contract for production routes and dev HMR

@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 1, 2026 7:01am UTC

Request Review

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Oct 1, 2026
@astracat-bot

astracat-bot Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Oct 1, 2026, 3:41 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

14 of 420 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Chat Full AI Chat probe light 155,733
Chat Full AI Chat probe dark 155,005
Chat Default neutral dark 33,205
Chat Default neutral light 32,876
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,229
Chat With Attachments probe dark 11,065
Markdown Default probe dark 897
Markdown Default probe light 897
Markdown Default neutral dark 882
Markdown Default neutral light 858

Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pulling the Turbopack path, the boundary guards, and the browser contract together — the direction is clear and the app-wide CSS limitation is stated honestly.

Approval needs a maintainer decision first. This change sets a new consumer direction: the official Next 16 Babel + PostCSS Turbopack path with a stated version floor, a precompiled-Astryx-only compiler boundary, and a product layer/prefix contract, replacing the previous SWC guidance in the shipped styling guide. I could not find a current governing record that settles that direction, so a maintainer needs to provide or identify the record that covers those three points, or update the existing record, before this can be approved on its merits. Nothing needs to be removed or split for that reason alone.

Two things to fix once the direction is settled:

  • The swizzle command still warns Next builders that the Babel plugin breaks next/font and points them to the SWC setup "covered in the guide" — please align that warning with the new guide so the two shipped surfaces agree.
  • The styling guide's postcss snippet references stylexPlugin without showing where it comes from and lists a repository-only exclude path; please make the snippet copyable as written for a consumer project.

The line count is comfortably in scope, and the CI routing into the existing build-test job looks right. I did not run the build or browser contract in this pass, so the rendering and HMR claims still need that passing run before landing.

[Automated review]

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pulling the Turbopack path, the boundary guards, and the browser contract together — the direction is clear, the app-wide CSS limitation is stated honestly, and the two guidance fixes from the last pass (the swizzle warning alignment and the copyable postcss snippet) are now in.

Approval needs a maintainer decision first. This change sets a new consumer direction: the official Next 16 Babel + PostCSS Turbopack path with a stated version floor, a precompiled-Astryx-only compiler boundary, and a product layer/prefix contract, replacing the previous SWC guidance in the shipped styling guide. I could not find a current governing record that settles that direction, so a maintainer needs to provide or identify the record that covers those three points, or update the existing record, before this can be approved on its merits. Nothing needs to be removed or split for that reason alone, and no code change is being requested for the hold itself.

The line count is comfortably in scope, the CI routing into the existing build-test job looks right, and the browser contract passes in CI at this revision. Once a maintainer settles the direction in a current record, this is ready to approve on its merits.

[Automated review]

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pulling the Turbopack path, the boundary guards, and the browser contract together — the direction is clear, the app-wide CSS limitation is stated honestly, and the two guidance fixes from the last pass (the swizzle warning alignment and the copyable postcss snippet) are now in. The latest revision also gives the Turbopack watcher a settle wait before the first HMR mutation.

Approval needs a maintainer decision first. This change sets a new consumer direction: the official Next 16 Babel + PostCSS Turbopack path with a stated version floor, a precompiled-Astryx-only compiler boundary, and a product layer/prefix contract, replacing the previous SWC guidance in the shipped styling guide. I could not find a current governing record that settles that direction, so a maintainer needs to provide or identify the record that covers those three points, or update the existing record, before this can be approved on its merits. Nothing needs to be removed or split for that reason alone, and no code change is being requested for the hold itself.

The line count is comfortably in scope, and the CI routing into the existing build-test job looks right. The browser contract run for this revision was still in progress when this review was written, so that passing result still needs to land before merging. Once a maintainer settles the direction in a current record, this is ready to approve on its merits.

[Automated review]

@cixzhang

Copy link
Copy Markdown
Contributor Author

(Posted by Cindy's agent.) Superseded: main's example already uses the official StyleX Babel + PostCSS setup with plain next dev, which is Turbopack on Next 16, via #10680 and #11305. The remaining wording moves to a small docs pull request.

@cixzhang cixzhang closed this Nov 12, 2026
@github-actions
github-actions Bot deleted the feat/next-stylex-migration branch November 13, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — 3bd77c64 Deployed Oct 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant