Skip to content

fix(examples): the Next.js source and StyleX templates install and build with npm - #10680

Merged
cixzhang merged 2 commits into
mainfrom
fix/example-nextjs-babel-7
Nov 8, 2026
Merged

cixzhang merged 2 commits into
mainfrom
fix/example-nextjs-babel-7

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

User impact

This affects anyone who copies the example-nextjs-source or example-nextjs-stylex template and installs and builds it with npm.

  • Today: npm install fails with ERESOLVE could not resolve in both templates, so the template does not install at all. pnpm installs it. Past that, next build fails in the source template (the StyleX Babel plugin rejects the border shorthand in src/app/page.tsx), and in both templates next build installs @types/node into the copied package.json on its own.
  • After this change: npm install and npm run build both succeed in each template, with one @babel/core 7.x shared by every Babel package, and the build leaves package.json untouched.
  • Unchanged: apart from the page's border longhands, the templates' build setup (babel.config.js through @astryxdesign/build), every other dependency, and the workspace lockfile. The example apps sit outside the pnpm workspace.

Problem and solution fit

  • Why it fails: the templates pair @babel/preset-react@^8.0.1 with @babel/preset-typescript@^7.29.7. preset-react 8 peers on @babel/core ^8, while preset-typescript 7 and @stylexjs/babel-plugin 0.19 (which depends on @babel/core ^7.26.8) need Babel 7. No single @babel/core satisfies both, and npm's strict peer resolution refuses the install.
  • Why it matters: these templates exist for people to copy; a template that does not install is the first thing a new user meets.
  • The fix: move @babel/preset-react back to ^7.29.7 in both templates, the major every other Babel package in them uses. The workspace catalog already holds all Babel packages on 7.x for this reason (its comment names the same split). Moving the templates to Babel 8 would need @babel/core 8 and a StyleX Babel plugin that supports it, which is a migration of its own.

Expected behavior and authority

The templates are standalone consumer apps that pin their own versions (pnpm-workspace.yaml), so they must install with the package manager a person uses. The workspace catalog records that Babel stays on 7.x until a planned Babel 8 migration.

Smallest restoration

  • apps/example-nextjs-source/package.json and apps/example-nextjs-stylex/package.json: @babel/preset-react ^8.0.1 → ^7.29.7, and @types/node ^25.9.3 (the range the repository root and sandbox use).
  • apps/example-nextjs-source/src/app/page.tsx: the card's border: '1px solid var(--color-border)' becomes borderWidth: 1, borderStyle: 'solid', borderColor: 'var(--color-border)'; the StyleX Babel plugin rejects the shorthand.
  • No other template, and none of the other examples, change.
  • No changeset: the example apps are not published packages.
  • Dependabot scans only the workspace root and ignores semver-major updates, so it does not re-raise this split.

Evidence

  • Reproduction before the change: a clean npm install --no-audit --no-fund --ignore-scripts of each template's package.json on main exits 1 with npm error code ERESOLVE.
  • Result after the change: in a clean copy of each template, npm install exits 0 and npm run build exits 0 ("Compiled successfully"), without next build installing anything into package.json; npm ls shows one @babel/[email protected], deduped across presets and the StyleX plugin.
  • Representative unchanged path: pnpm install --frozen-lockfile at the root passes with no lockfile change.

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • Clean npm install in a copy of each template, before (exit 1, ERESOLVE) and after (exit 0).
  • npm run build in a clean copy of each template after npm install: exit 0 in both; package.json is byte-identical before and after the build.
  • npm ls @babel/core @babel/preset-react @babel/preset-typescript after: one @babel/core 7.x.
  • pnpm install --frozen-lockfile: passes, lockfile unchanged.

…eset-react on Babel 7

preset-react 8 peers on @babel/core 8 while preset-typescript 7 and @stylexjs/babel-plugin 0.19 need @babel/core 7, so npm install failed with ERESOLVE in both templates. The workspace catalog already holds every Babel package on 7.x.
@vercel

vercel Bot commented Nov 8, 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 Nov 8, 2026 4:11pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 8, 2026
@astracat-bot

astracat-bot Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 8, 2026, 5:02 PM UTC

@cixzhang

cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 9093e18

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 56bf707

Storybook · Sandbox · built from this PR's head

Package size: no published package changed; no new dependencies.

API changes: none in this pull request

Committed API report behind this build: cli 29 rows, core 35 rows, theme-butter 1 row, theme-y2k 1 row; run pnpm api:report.

Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.


Generated by PR Enrichment workflow | 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.

Approved pending CI: CI has not run on this head yet, because the pull request is a draft. CI runs once it is marked ready for review.

Moving @babel/preset-react back to ^7.29.7 fixes the npm install of both templates. A clean install of either template fails with ERESOLVE on main and succeeds here, with one @babel/core 7.x shared by the presets and the StyleX plugins.

  • Optional wording fix: the description says Dependabot ignores semver-major updates, but .github/dependabot.yml ignores them only for jsdom. The templates stay out of Dependabot's reach because they sit outside the pnpm workspace.
  • Separate from this change: after a clean install, apps/example-nextjs-source still fails npm run build. StyleX property validation rejects the border shorthand at src/app/page.tsx:45.

[Automated review]

@cixzhang
cixzhang marked this pull request as ready for review November 8, 2026 15:23
The source template's page used the border shorthand, which the StyleX Babel plugin rejects; it now sets borderWidth, borderStyle and borderColor. Both templates declare @types/node, which next build otherwise installs into the copied package.json.
@cixzhang cixzhang changed the title fix(examples): the Next.js source and StyleX templates install with npm (Babel 7 throughout) fix(examples): the Next.js source and StyleX templates install and build with npm Nov 8, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 8, 2026
@cixzhang

cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 56bf707

@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.

Approved pending CI: the required build, test and docsite-test suites have not run on this head yet; they run before merge.

Both templates now install and build with npm. A clean npm install fails with ERESOLVE on main and succeeds here with one @babel/core 7.x, and npm run build succeeds in each without changing package.json.

  • Optional wording fix: the description says Dependabot ignores semver-major updates, but .github/dependabot.yml ignores them only for jsdom; the templates stay out of Dependabot's reach because they sit outside the pnpm workspace.

[Automated review]

@cixzhang
cixzhang merged commit f9d4679 into main Nov 8, 2026
107 of 110 checks passed
@cixzhang
cixzhang deleted the fix/example-nextjs-babel-7 branch November 8, 2026 19:46

This branch was successfully deployed

1 active deployment
Preview — 56bf7073 Deployed Nov 8, 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