Skip to content

Commit

Permalink
Skip hermes-parser under Babel for non-Flow JS code (#47568)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #47568

Resolves facebook/hermes#1549.

Changelog:
[General][Fixed] - When using Babel with plain JavaScript files, support for additional user syntax plugins should be fixed (now uses Babel's parser instead of hermes-parser). There is no change for JS files annotated with `flow`, where extended JS syntax remains unsupported.

Differential Revision: D65816797
  • Loading branch information
huntie authored and facebook-github-bot committed Nov 12, 2024
1 parent 9e7ff3b commit 2c8d037
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-native-babel-preset/src/configs/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function isTSXSource(fileName) {
const loose = true;

const defaultPlugins = [
[require('babel-plugin-syntax-hermes-parser')],
[require('babel-plugin-syntax-hermes-parser'), {parseLangTypes: 'flow'}],
[require('babel-plugin-transform-flow-enums')],
[require('@babel/plugin-transform-block-scoping')],
[require('@babel/plugin-transform-class-properties'), {loose}],
Expand Down

0 comments on commit 2c8d037

Please sign in to comment.