Commit 63796a9
Prevent Crashes by Guarding babel.env Access in RN Babel Preset (#55918)
Summary:
Pull Request resolved: #55918
To prevent crashes when a Babel plugin or preset is invoked without a Babel API object, ensure that any access to Babel-specific properties (such as babel.env) is guarded. Some build tools or environments may call Babel plugins without providing the full Babel API instance, leading to runtime errors if the code assumes its presence. By using optional chaining and providing safe fallbacks, you can maintain compatibility across different build systems (such as Metro and others) without introducing breaking changes.
Changelog:
[General][Fixed] Prevent errorrs by handling contexts where the Babel API object is not provided
Reviewed By: robhogan, rubennorte
Differential Revision: D94952379
fbshipit-source-id: 65e69c0510bc66930ee3b5f28e20df32d732f9901 parent 6b32971 commit 63796a9
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
0 commit comments