You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Swizzled components emit StyleX source, but no docs explain the required StyleX build/compiler setup (breaks silently; Next.js/SWC has no guidance) #3373
astryx swizzle <Component> copies the component's raw StyleX source into your app. That source requires a build-time StyleX compiler to produce atomic CSS — but nothing in the CLI output or docs tells you this, and there's no framework-specific setup guidance. The result: a freshly swizzled component compiles but renders unstyled, with no error, and it's non-obvious why.
Drop <Button> into an app that has no StyleX compiler wired into its build and it renders with no styles — stylex.props() returns nothing usable because stylex.create(...) was never compiled to atomic CSS. No build error, no runtime warning.
The docs gap
astryx docs styling, astryx docs styling-libraries, and astryx docs swizzle all explain how to author StyleX using system tokens (tokens.stylex, colorVars, xstyle, etc.), but none of them mention that:
Consuming swizzled components (or authoring any StyleX) requires a StyleX compiler in your app's build, and
How to actually set that compiler up per framework.
Grepping the docs for babel, swc, next.config, compiler, transform, plugin returns nothing.
Next.js App Router specifically (the painful case)
StyleX's canonical compiler is a Babel plugin (@stylexjs/babel-plugin). In Next.js, introducing a Babel config disables the SWC compiler, which in turn breaks SWC-dependent features like next/font. So the "obvious" StyleX setup is actively incompatible with a standard Next 15 App Router app.
The working path is an SWC-based StyleX transform (e.g. the community @stylexswc/nextjs-plugin), but a first-time user has no way to discover this from Astryx — they hit swizzle → unstyled component → try the babel plugin → break next/font → dead end.
Suggestions
Have astryx swizzle print a post-copy note: "These components use StyleX and require a StyleX compiler in your build — see ."
Add a docs section (e.g. under swizzle or styling) covering the StyleX build requirement with per-bundler setup: Webpack, Vite, Next.js (SWC vs Babel, and the next/font conflict).
Consider warning at build/dev time when StyleX source is present but no compiler is detected.
Context
Discovered while building a themed marketing surface on Astryx in a Next 15 App Router app. Pure theme + defineTheme needs no StyleX compilation, which is great — but the moment you swizzle, you fall off a cliff with no signposting. (Companion type-safety bug filed separately: custom-variant augmentation naming — #3371.)
Activity
fix(cli): document StyleX build requirement for swizzled components