Skip to content

react-native-worklets does not declare @babel/generator or @babel/traverse #9648

Description

@jparkrr

Description

This is a follow-up to #9530 and the fix in #9511.

@babel/types was added to react-native-worklets dependencies, but the bundled Babel plugin has two other runtime imports that remain undeclared:

@babel/generator is also imported by workletFactory.ts.

The plugin build uses packages: 'external', so these remain runtime require() calls in the published bundle. However, neither package is listed in the published package's dependencies.

Steps to reproduce

  1. Use pnpm 11 with its isolated dependency layout.
  2. Install the versions listed below.
  3. Configure Babel with react-native-worklets/plugin.
  4. Run a clean install:
    pnpm install --frozen-lockfile
  5. Load the plugin or start an Expo export:
    node -e "require('react-native-worklets/plugin')"
    
  6. Observe Cannot find module '@babel/generator'.
  7. Add only @babel/generator and repeat. It then fails with Cannot find module '@babel/traverse'.

Snack or a link to a repository

https://github.com/jparkrr/react-native-worklets-pnpm-repro

Reanimated version

4.4.1

Worklets version

0.9.2

React Native version

0.85.3

Platforms

iOS

JavaScript runtime

None

Workflow

None

Architecture

None

Reanimated feature flags

None

React Native release level

None

Build type

No response

Device

No response

Host machine

None

Device model

No response

Acknowledgements

Yes

Metadata

Metadata

Assignees

Labels

Platform: iOSThis issue is specific to iOSRepro providedA reproduction with a snippet of code, snack or repo is provided

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions