Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily understand what the code changes affect. --> ## Summary React Native Babel preset uses a loose plugin to convert imports to commonjs, we're investigating switching to a more standard approach in Expo CLI here expo/expo#30005 which aligns with how Metro is used at Meta. When running on the kitchen sink, I found that there was an invalid expression in reanimated where it exports null and then destructures null. This error didn't occur previously because the commonjs plugin deferred access to the null object until later. **Before** ```js var _Math = _$$_REQUIRE(_dependencyMap[0]); // Later ... _Math.add ``` This coincidentally didn't throw because the deferred code is never accessed. **After** ```js var add = _$$_REQUIRE(_dependencyMap[0]).add; ``` This throws because the `null` is accessed when the module is loaded. ## Test plan Bundle a Metro web project with experimentalImportSupport enabled: ```js config.transformer.getTransformOptions = async () => ({ transform: { experimentalImportSupport: true, inlineRequires: false, }, }); ``` Then run `npx serve dist` -> Error was there but not anymore.
- Loading branch information