Repository navigation
fix(react-native): configure the Worklets Babel plugin with strictGlobal - #83
Open
NathanWalker wants to merge 1 commit into
Open
NathanWalker wants to merge 1 commit into
NathanWalker wants to merge 1 commit into
Conversation
Without strictGlobal the Worklets plugin captures every name a worklet
does not declare into its closure, read on the JS thread when the module
is evaluated, where NativeScript's classes do not exist: a module-level
worklet naming UILabel failed at startup with
"ReferenceError: Property 'UILabel' doesn't exist".
The config plugin and configure CLI now write
['react-native-worklets/plugin', { strictGlobal: true }] and
['babel-preset-expo', { worklets: false }] (so the preset adds no second
copy), upgrade bare entries in an existing config, and warn when an
entry with options lacks strictGlobal. The Babel setup also runs on
Android-only prebuilds.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This was referenced Oct 24, 2026
This branch has not been 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.
Split out of #77 (item 5 of the "NativeScript bugs" list in ng-native/ng-native#931).
Summary
Without
strictGlobal, the Worklets Babel plugin captures every name a worklet doesn't declare into the worklet's closure. That closure is read on the JS thread when the defining module is evaluated, and NativeScript's classes don't exist there. A module-level worklet that namesUILabelfailed at startup withReferenceError: Property 'UILabel' doesn't exist.strictGlobalgets a warning rather than a rewrite.The README changes for this are in the README PR.
Evidence
node test/config-plugin.test.jsruns the real plugin against temp project directories.The other package tests give the same results as on the base branch.
On the iOS simulator (tested in #77), a module-level worklet naming
UILabelloads.Merge Danger
Door: two-way
Blast Radius: generated
babel.config.jsIt rewrites existing configs, but only bare
react-native-worklets/pluginandbabel-preset-expoentries. Entries the user has already given options to are left alone and only warned about.