Repository navigation
fix(examples): the Next.js source and StyleX templates install and build with npm - #10680
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 9093e18 |
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
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.ymlignores them only forjsdom. 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-sourcestill failsnpm run build. StyleX property validation rejects thebordershorthand atsrc/app/page.tsx:45.
[Automated review]
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.
|
/approve-spec 56bf707 |
There was a problem hiding this comment.
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.ymlignores them only forjsdom; the templates stay out of Dependabot's reach because they sit outside the pnpm workspace.
[Automated review]
User impact
This affects anyone who copies the
example-nextjs-sourceorexample-nextjs-stylextemplate and installs and builds it with npm.npm installfails withERESOLVE could not resolvein both templates, so the template does not install at all. pnpm installs it. Past that,next buildfails in the source template (the StyleX Babel plugin rejects thebordershorthand insrc/app/page.tsx), and in both templatesnext buildinstalls@types/nodeinto the copiedpackage.jsonon its own.npm installandnpm run buildboth succeed in each template, with one@babel/core7.x shared by every Babel package, and the build leavespackage.jsonuntouched.babel.config.jsthrough@astryxdesign/build), every other dependency, and the workspace lockfile. The example apps sit outside the pnpm workspace.Problem and solution fit
@babel/preset-react@^8.0.1with@babel/preset-typescript@^7.29.7. preset-react 8 peers on@babel/core^8, while preset-typescript 7 and@stylexjs/babel-plugin0.19 (which depends on@babel/core^7.26.8) need Babel 7. No single@babel/coresatisfies both, and npm's strict peer resolution refuses the install.@babel/preset-reactback to^7.29.7in 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/core8 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.jsonandapps/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'sborder: '1px solid var(--color-border)'becomesborderWidth: 1,borderStyle: 'solid',borderColor: 'var(--color-border)'; the StyleX Babel plugin rejects the shorthand.Evidence
npm install --no-audit --no-fund --ignore-scriptsof each template'spackage.jsonon main exits 1 withnpm error code ERESOLVE.npm installexits 0 andnpm run buildexits 0 ("Compiled successfully"), withoutnext buildinstalling anything intopackage.json;npm lsshows one@babel/[email protected], deduped across presets and the StyleX plugin.pnpm install --frozen-lockfileat the root passes with no lockfile change.Scope
Testing
npm installin a copy of each template, before (exit 1, ERESOLVE) and after (exit 0).npm run buildin a clean copy of each template afternpm install: exit 0 in both;package.jsonis byte-identical before and after the build.npm ls @babel/core @babel/preset-react @babel/preset-typescriptafter: one@babel/core7.x.pnpm install --frozen-lockfile: passes, lockfile unchanged.