facebook / metro

🚇 The JavaScript bundler for React Native
https://metrobundler.dev
MIT License
5.25k stars 626 forks source link

Add @react-native/babel-plugin-codegen to the preset if src is null #1078

Closed dmytrorykun closed 1 year ago

dmytrorykun commented 1 year ago

Summary: X-link: https://github.com/facebook/react-native/pull/39159

Source is not required for getPreset of react-native/babel-preset. There is a codition that adds react-native/babel-plugin-codegen to the preset only if source is passing certain regex. This condition fails if source is null, but that's wrong because the plugin may still be requred for this transformation even though source is not provided. This diff changes the condition so the regexp tests source only if it is not null, and react-native/babel-plugin-codegen automatically added to the preset otherwise. Changelog: [Internal]

Reviewed By: robhogan, RSNara

Differential Revision: D48684443

facebook-github-bot commented 1 year ago

This pull request was exported from Phabricator. Differential Revision: D48684443

facebook-github-bot commented 1 year ago

This pull request was exported from Phabricator. Differential Revision: D48684443

facebook-github-bot commented 1 year ago

This pull request was exported from Phabricator. Differential Revision: D48684443

facebook-github-bot commented 1 year ago

This pull request was exported from Phabricator. Differential Revision: D48684443

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage has no change and project coverage change: -0.01% :warning:

Comparison is base (e0dd91b) 83.39% compared to head (e8bb13b) 83.38%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1078 +/- ## ========================================== - Coverage 83.39% 83.38% -0.01% ========================================== Files 209 209 Lines 10835 10836 +1 Branches 2725 2725 ========================================== Hits 9036 9036 - Misses 1799 1800 +1 ``` | [Files Changed](https://app.codecov.io/gh/facebook/metro/pull/1078?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=facebook) | Coverage Δ | | |---|---|---| | [...ackages/metro-babel-register/src/babel-register.js](https://app.codecov.io/gh/facebook/metro/pull/1078?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=facebook#diff-cGFja2FnZXMvbWV0cm8tYmFiZWwtcmVnaXN0ZXIvc3JjL2JhYmVsLXJlZ2lzdGVyLmpz) | `28.12% <0.00%> (-0.91%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

facebook-github-bot commented 1 year ago

This pull request was exported from Phabricator. Differential Revision: D48684443

facebook-github-bot commented 1 year ago

This pull request was exported from Phabricator. Differential Revision: D48684443