[0.76 RC] Babel preset is incomplete without hermes-parser
#46601
Labels
Resolution: PR Submitted
A pull request with a fix has been provided.
hermes-parser
#46601
Description
Problem
JavaScript files using newer Flow syntax (e.g.,
as
type casts) fail to transpile correctly in React Native's Metro preset whenhermesParser
is disabled. This is becausebabel-parser
no longer fully supports Flow, and Hermes parser is now required for handling the latest Flow features.Background
babel-parser
no longer fully supports newer Flow features due to the Flow plugin being unmaintained:[Discussion] Remove
flow
support from@babel/parser
babel/babel#16264.hermesParser
by default in0.76.0
:RN: Enable Hermes Parser in RNTester / CI #46318
Proposed Solution
To make the Metro preset self-sufficient, we should consider including babel-plugin-syntax-hermes-parser in the preset. This would ensure that even when used without metro, babel can still transpile newer flow syntax properly.
Steps to reproduce
yarn install
yarn react-native start
http://localhost:8081/index.bundle?platform=ios
in the browser or by running the appReact Native Version
0.76.0-rc.1
Affected Platforms
Build - MacOS, Build - Windows, Build - Linux
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://github.com/jbroma/RN76BabelPresetReproducer
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: