Skip to content

[fix] Fix broken playground - #1847

Merged
nmn merged 1 commit into
mainfrom
fix/playground
Sep 5, 2026
Merged

[fix] Fix broken playground#1847
nmn merged 1 commit into
mainfrom
fix/playground

Conversation

@nmn

@nmn nmn commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

What changed / motivation ?

The playground compilation is currently broken. This fixes that.

@nmn
nmn requested a review from mellyeliu as a code owner September 5, 2026 00:02
Copilot AI lite review requested due to automatic review settings September 5, 2026 00:02
@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
stylex Ignored Ignored Sep 5, 2026 12:02am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The newly added test mutates globalThis.global but doesn’t verify the mutation succeeded, so it may not actually validate the intended “no global alias” scenario.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Fixes StyleX’s static evaluator to work in the playground/browser bundle by avoiding Node-specific global usage and instead using globalThis.

Changes:

  • Introduce a globalObject alias to globalThis for runtime-global access in both Node and browser bundles.
  • Replace global.* lookups in the evaluator with globalObject.*.
  • Add a regression test intended to validate evaluation when the Node global alias is absent.
File summaries
File Description
packages/@stylexjs/babel-plugin/src/utils/evaluate-path.js Switch evaluator’s global access from Node global to globalThis via globalObject to support browser bundles.
packages/@stylexjs/babel-plugin/src/utils/tests/evaluate-path-test.js Add coverage for evaluating built-ins in an environment without the Node global alias.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +127 to +131
const globalDescriptor = Object.getOwnPropertyDescriptor(
globalThis,
'global',
);
Reflect.deleteProperty(globalThis, 'global');
@nmn
nmn merged commit a58e3fc into main Sep 5, 2026
14 checks passed
@nmn
nmn deleted the fix/playground branch September 5, 2026 00:07
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

workflow: benchmarks/perf

Comparison of performance test results, measured in operations per second. Larger is better.
yarn workspace v1.22.22
yarn run v1.22.22
$ node ./compare.js /tmp/tmp.pvLH4CrTEV /tmp/tmp.wK7A8BGzY5

Results Base Patch Ratio
babel-plugin: stylex.create
· basic create 584 586 1.00 +
· complex create 64 66 1.03 +
babel-plugin: stylex.createTheme
· basic themes 450 462 1.03 +
· complex themes 32 32 1.00
Done in 0.08s.
Done in 0.34s.

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

workflow: benchmarks/size

Comparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
yarn workspace v1.22.22
yarn run v1.22.22
$ node ./compare.js /tmp/tmp.6Ud5kLYgDR /tmp/tmp.YbX4NRdkPv

Results Base Patch Ratio
@stylexjs/stylex/lib/cjs/stylex.js
· compressed 1,535 1,535 1.00
· minified 5,166 5,166 1.00
@stylexjs/stylex/lib/cjs/inject.js
· compressed 1,793 1,793 1.00
· minified 4,915 4,915 1.00
benchmarks/size/.build/bundle.js
· compressed 496,650 496,650 1.00
· minified 4,847,840 4,847,840 1.00
benchmarks/size/.build/stylex.css
· compressed 99,735 99,757 1.00 +
· minified 740,755 748,850 1.01 +
Done in 0.09s.
Done in 0.34s.

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 Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants