Skip to content

fix(repack): support flow-parser in React Native 0.88 - #1476

Merged
dannyhw merged 3 commits into
callstack:mainfrom
whydidoo:fix/support_rn_0.88
Oct 6, 2026
Merged

dannyhw merged 3 commits into
callstack:mainfrom
whydidoo:fix/support_rn_0.88

Conversation

@whydidoo

@whydidoo whydidoo commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

React Native 0.88 replaces the Hermes parser dependency in its Babel preset with flow-parser, which breaks Re.Pack's hard-coded parser lookup.

Resolve the parser and matching Babel syntax plugin from the application's React Native preset. Use the same resolution for the Babel loader, codegen, and Reanimated, while keeping support for older Hermes-based presets.

Fixes #1474.

Test plan

  • Core and integration test suites, plus type checks.
  • Parser regression tests for RN 0.87.0 and 0.88.0-rc.3 on Webpack and Rspack, covering JS, Flow, TypeScript, TSX, and codegen.
  • Native Release builds on iOS Simulator and Android Emulator with Reanimated 4.7.1 and Worklets 0.13.0, using both babel-loader and babel-swc-loader. Verified UI-thread animation and completion callbacks.

RN 0.87 builds used a targeted ReactNativeFeatureFlags alias for an existing package exports issue, also reproduced with the old loader. RN 0.88 RC passed without it.

…ogic

- Updated references from `loadHermesParser` to `loadReactNativeParser` in babelLoader and utils.
- Adjusted the transform function to utilize the new parser.
- Modified codegen transform rules to use the new React Native syntax plugin.
- Added new integration tests for React Native parser handling Flow, TypeScript, and TSX files.
- Introduced new fixture files for testing React Native components and their parsing.
- Updated package dependencies in pnpm-lock.yaml and package.json for Babel runtime and React Native presets.
@changeset-bot

changeset-bot Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 546d223

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@callstack/repack Patch
@callstack/repack-plugin-reanimated Patch
@callstack/repack-plugin-expo-modules Patch
@callstack/repack-plugin-nativewind Patch
@callstack/repack-dev-server Patch
@callstack/repack-init Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Oct 3, 2026

Copy link
Copy Markdown

@whydidoo is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

@whydidoo
whydidoo requested review from bartekkrok and dannyhw October 3, 2026 19:15
@CristiCeban

Copy link
Copy Markdown

Thanks for this! The parser change looks right to me. I checked the @react-native/babel-preset@0.88.0-rc.3 source: it uses require('flow-parser/babel-plugin') with parseLangTypes: 'flow' and reactRuntimeTarget: '19'. flow-parser@0.327.0 accepts the same parse() options Re.Pack already passes (babel, reactRuntimeTarget, sourceType), and it defaults to flow: 'detect' just like hermes-parser. So it's a drop-in swap.
What I verified:

  • react-native-parser.test.ts passes locally (12 tests).
  • I installed this branch into a fresh react-native@0.88.0-rc.3 app made with repack-init. The Cannot find module 'babel-plugin-syntax-hermes-parser' error is gone.
  • With package exports enabled, iOS release, iOS dev and Android release all bundle. The iOS Release build runs on the simulator, and an MF2 host loading a remote over HTTP works, including a lazy chunk inside the remote and shared singletons.
    The issue command still fails after this PR. On a fresh repack-init project, the command from React Native 0.88.x support #1474 now fails with:
 Can't resolve 'react-native/react-private-interface'
 Can't resolve 'react-native/setup-env'
 Can't resolve '@react-native/asset-utils'

Which is separate one, it errors only when enablePackageExports: false. not related to this PR.
I've left a few smaller inline comments too.

Comment thread packages/repack/src/loaders/babelLoader/utils.ts Outdated
Comment thread tests/integration/package.json
Comment thread packages/repack/src/helpers/resolveReactNativeParser.ts Outdated
Comment thread packages/repack/src/babelPlugins/syntaxReactNative.ts
@whydidoo

whydidoo commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for this! The parser change looks right to me. I checked the @react-native/babel-preset@0.88.0-rc.3 source: it uses require('flow-parser/babel-plugin') with parseLangTypes: 'flow' and reactRuntimeTarget: '19'. flow-parser@0.327.0 accepts the same parse() options Re.Pack already passes (babel, reactRuntimeTarget, sourceType), and it defaults to flow: 'detect' just like hermes-parser. So it's a drop-in swap. What I verified:

  • react-native-parser.test.ts passes locally (12 tests).
  • I installed this branch into a fresh react-native@0.88.0-rc.3 app made with repack-init. The Cannot find module 'babel-plugin-syntax-hermes-parser' error is gone.
  • With package exports enabled, iOS release, iOS dev and Android release all bundle. The iOS Release build runs on the simulator, and an MF2 host loading a remote over HTTP works, including a lazy chunk inside the remote and shared singletons.
    The issue command still fails after this PR. On a fresh repack-init project, the command from React Native 0.88.x support #1474 now fails with:
 Can't resolve 'react-native/react-private-interface'
 Can't resolve 'react-native/setup-env'
 Can't resolve '@react-native/asset-utils'

Which is separate one, it errors only when enablePackageExports: false. not related to this PR. I've left a few smaller inline comments too.

Thanks for testing this! RN 0.88 exposes these entry points through package exports, so enablePackageExports: true is required in a standard Re.Pack setup. This is part of the RN 0.88 migration, and we should document that requirement alongside the parser fix.

…e documentation for package exports in Re.Pack
@whydidoo

whydidoo commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator Author

@CristiCeban all were fixed

@dannyhw
dannyhw merged commit 5bb41f0 into callstack:main Oct 6, 2026
3 of 4 checks passed
@dannyhw

dannyhw commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

nice work, thanks @whydidoo 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

React Native 0.88.x support

3 participants