[fix] Fix broken playground - #1847
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
🟡 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
globalObjectalias toglobalThisfor runtime-global access in both Node and browser bundles. - Replace
global.*lookups in the evaluator withglobalObject.*. - Add a regression test intended to validate evaluation when the Node
globalalias 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.
| const globalDescriptor = Object.getOwnPropertyDescriptor( | ||
| globalThis, | ||
| 'global', | ||
| ); | ||
| Reflect.deleteProperty(globalThis, 'global'); |
workflow: benchmarks/perfComparison of performance test results, measured in operations per second. Larger is better.
|
workflow: benchmarks/sizeComparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
|
What changed / motivation ?
The playground compilation is currently broken. This fixes that.