Repository navigation
build(core): re-add @stylexjs/stylex to dependencies (Yarn runtime presence) - #3691
Closed
imdreamrunner wants to merge 1 commit into
Closed
imdreamrunner wants to merge 1 commit into
imdreamrunner wants to merge 1 commit into
Conversation
|
Deployment failed with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
imdreamrunner
marked this pull request as ready for review
July 8, 2026 15:28
imdreamrunner
requested review from
cixzhang,
ejhammond,
josephfarina,
marie-lucas,
nynexman4464 and
thedjpetersen
as code owners
July 8, 2026 15:28
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 |
imdreamrunner
force-pushed
the
fix/stylex-runtime-yarn
branch
from
July 28, 2026 18:32
66c5453 to
91559d0
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
cixzhang
reviewed
Jul 29, 2026
Follow-up to #3313, which moved @stylexjs/stylex to a peer-only declaration. Consumer research shows the astryx base predominantly uses Yarn, and neither Yarn 1 nor Yarn Berry auto-installs peer dependencies (verified) — so peer-only leaves the StyleX runtime ABSENT for those consumers, a hard render failure since every component calls stylex.props(). Declare @stylexjs/stylex in BOTH dependencies and peerDependencies (^0.18.3): dependencies guarantees the runtime is present on every package manager (incl. Yarn 1/Berry); peerDependencies keeps the version guardrail and dedupes a StyleX-authoring consumer to a single shared runtime (browser + Node). Test plan: - pnpm install + pnpm -F @astryxdesign/core build: green. - Verified: peer-only leaves the runtime absent on Yarn 1 and Yarn Berry 4.9.2 (warning only); adding dependencies restores presence.
imdreamrunner
force-pushed
the
fix/stylex-runtime-yarn
branch
from
July 29, 2026 17:46
91559d0 to
5bf3103
Compare
Contributor
Author
|
We decided to not go with this approach and I will create a separate PR to update the docs. For context:
|
This branch was successfully deployed
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.
Summary
@astryxdesign/corecurrently declares@stylexjs/stylexas peer-only (since #3313, released in0.1.3 / 0.1.4). This PR also declares it in
dependencies(keeping the peer) — the "combo":"peerDependencies": { "@stylexjs/stylex": "^0.18.3", "react": ">=19.0.0", "react-dom": ">=19.0.0" }, + "dependencies": { + "@stylexjs/stylex": "^0.18.3" + },Whether to add it is a genuine trade-off. This PR takes the support-Yarn side; the alternative (keep
peer-only) is equally coherent if the priorities differ.
The trade-off
Option A — keep peer-only (don't merge this): the npm-style, strict-single-runtime choice.
(npm
ERESOLVE), never silently duplicated.pnpm ≤8.0 and all of 7.x default
auto-install-peerstofalse, so peer-only leaves the runtimeabsent there too — the failure mode isn't Yarn-exclusive.
hard render crash (every astryx component calls
stylex.props()).Option B — also declare it in
dependencies(this PR): the support-Yarn choice.dependenciesentry self-satisfies the peer, so an incompatibleversion is silent (a nested 2nd copy; our components run their own compatible copy).
How to choose: if the consumer base were npm / pnpm / Bun and you value the strict single-runtime
guarantee, keep peer-only (A). Because the astryx consumer base is predominantly Yarn — where
peer-only leaves the runtime absent — this PR chooses B.
Behavior by package-manager version (verified)
1. Consumer authors no StyleX — is the runtime present?
🟢 present · 🔴 absent (runtime missing → hard render crash). Peer-only presence tracks whether the
manager auto-installs peers; the combo is always present.
¹
auto-install-peers(added in pnpm 7.0.0) defaulted tofalseuntil the 8.x line, where it flippedto
true. Verified locally on Node 22: peer absent on 7.12.1 / 7.13.0 / 8.0.0, present from8.4.0 through 11.13.0. So on older pnpm, peer-only crashes exactly like Yarn.
2. Consumer pins an incompatible StyleX version (out of range)
🟢 caught (install blocked) · 🟡 warned · 🔴 silent (no signal). "runs own" = our components resolve
their own nested compatible copy (2 copies total); "runs theirs" = single shared copy at the consumer's
(out-of-range) version.
ERESOLVE)ERESOLVE)ERESOLVE)ERESOLVE)ERESOLVE)On npm 7–11 the combo is fully silent — no install warning, and
npm lsreports a valid tree, so theincompatibility is invisible to npm tooling.
3. Consumer pins a compatible StyleX version
Both methods, every manager → one shared copy = the consumer's install (same
realpath, browser +Node). Verified on npm, pnpm, Bun, Yarn 1, Yarn 4.
Edge case: Yarn 1 only leaves 2 copies if the consumer pins an exact, older-but-compatible
version (e.g.
0.18.1while0.18.3is latest) — its classic hoister resolves our range to latestindependently. npm, pnpm, Bun, and Yarn 4 dedupe even that. Benign for XDS regardless (
props()ispure).
pnpm presence is version- and config-dependent
The pnpm "present" result above is not a property of pnpm — it's the current default of
auto-install-peers, and it's consumer-overridable:autoInstallPeers: falsemakes peer-only absent again (verified on pnpm11.13.0 — runtime absent + a peer-deps warning). So even on modern pnpm, a consumer can opt back into
the missing-runtime crash. The combo (this PR) is present regardless of this setting.
pnpm-workspace.yaml(autoInstallPeers: false). Legacy.npmrc(auto-install-peers=false) and thenpm_config_auto_install_peersenv varare silently ignored by pnpm 11 — verified.
strict-peer-dependencies=falsedefault; a consumer withstrict-peer-dependencies=truegets a hardblock instead.
Net: peer-only's "single shared runtime" guarantee on pnpm depends on both a version default and two
consumer-flippable settings — another point in favor of the combo.
Recommendation
Declare
@stylexjs/stylexin bothpeerDependenciesanddependencies— keep the peer (versionguardrail) and add it to
dependencies(runtime guarantee), i.e. ship this PR.Why:
the runtime absent → every component crashes on
stylex.props(). Adding it todependenciesguarantees it's present on every package manager.
install — it installs silently (no
ERESOLVE, no warning, a cleannpm ls) and our components run asecond nested copy. We lose npm's strict single-runtime block on those managers.
Yarn, and npm 6, and on pnpm an incompatible version can still fail the install via
strict-peer-dependencies=true(verified on 11.13.0).Net: we trade npm/Bun's install-time block on incompatible versions for a runtime that's guaranteed
present everywhere. For a mostly-Yarn consumer base — where peer-only is a guaranteed crash — that's the
right call.
Test plan
pnpm install→@stylexjs/[email protected]resolved;pnpm -F @astryxdesign/core build→ green(babel ESM +
tscdeclarations + StyleX CSS + UMD).three tables above.
auto-install-peersdefault isfalseon pnpm7.12–8.0 (runtime absent, like Yarn) and
truefrom 8.4 onward;autoInstallPeers: falseinpnpm-workspace.yamlreproduces the absent runtime on pnpm 11.13.0.