Babel not Transforming Extra Modules
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.6k
- Forks
- 696
- Avg merge
- 8m
- Merged PRs (30d)
- 7
Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When specifying an extra node module in the config, Babel doesn't seem to be transforming the file properly:
metro.config.js
const extraNodeModules = {
'@apollosproject/config': path.resolve(
`${__dirname}/../../apollos-apps/packages/apollos-config/`
),
}
module.exports = {
resolver: {
extraNodeModules,
},
};
Bundle Error:
error: bundling failed: Error: Unable to resolve module `@babel/runtime/helpers/interopRequireDefault` from `/Users/michael/Documents/Projects/apollos/apollos-apps/packages/apollos-config/react-native/index.js`: Module `@babel/runtime/helpers/interopRequireDefault` does not exist in the Haste module map
index.js file in question:
import NativeConfig from 'react-native-config';
...
...
...
If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.
A minimal example would be very hard to repro as I am "linking" external modules.
What is the expected behavior?
The bundle builds properly.
Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
RN: 60
Node: 15
Yarn: 1.22
OS: Mac 11
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with metro.config.js and the linked module's react-native/index.js, then reproduce the bundle using the extraNodeModules configuration. Check how Babel output references @babel/runtime/helpers/interopRequireDefault; done means the bundle builds and resolves that dependency correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, javascript, react-native
- Domain
- build-system, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100