Bundling for Web attempts to import node.js modules from dependencies due to improper compiler environment selection
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?
Report a Bug
What is the current behavior?
When importing libraries like 'firebase' who depend use 'browser' as the main target and compiling for a metro 'browser' / web target the compiler still attempts to load node.js dependencies when it should not.
This has been previously reported to firebase-js-sdk but their staff believe this is a metro compiler issue.
See https://github.com/firebase/firebase-js-sdk/issues/7849#issuecomment-1857889012
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.
I will attempt to build you a repository for testing this as soon as I can.
This is easily reproduce when importing firebase@10.11 and attempting to access the firebase/auth package.
What is the expected behavior?
Only browser dependencies should load in a browser-based build.
Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
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 by reproducing the issue with firebase@10.11, the firebase/auth package, and a Metro browser/web target. Investigate the compiler environment selection and verify that the browser build no longer attempts to load Node.js dependencies; the issue does not name specific files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- firebase, javascript, node.js
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100