Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preserve require.context call when unstable_disableModuleWrapping is enabled #1129

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

EvanBacon
Copy link
Contributor

Summary

One possible way to implement tree shaking would require calling collectDependencies with unstable_disableModuleWrapping for a first pass, and invoking it a second time with module wrapping. The issue with this is that the require.context mutation is mutated to a format that wouldn't work on subsequent runs.

This PR will prevent the additional mutation of require.context -> require.

Test plan

Tests continue working

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 2, 2023
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6151e7e) 83.09% compared to head (3fd29e3) 83.09%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1129   +/-   ##
=======================================
  Coverage   83.09%   83.09%           
=======================================
  Files         206      206           
  Lines       10547    10548    +1     
  Branches     2617     2618    +1     
=======================================
+ Hits         8764     8765    +1     
  Misses       1783     1783           
Files Coverage Δ
packages/metro-transform-worker/src/index.js 87.03% <ø> (ø)
...etro/src/ModuleGraph/worker/collectDependencies.js 98.46% <100.00%> (+<0.01%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants