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

We should provide a way to have metro to not watch all the roots #536

Closed
acoates-ms opened this issue Aug 24, 2021 · 4 comments
Closed

We should provide a way to have metro to not watch all the roots #536

acoates-ms opened this issue Aug 24, 2021 · 4 comments
Assignees
Labels
feature: metro This is related to Metro

Comments

@acoates-ms
Copy link
Contributor

Metro by default will watch all the files within all the roots. This means that generally metro ends up watching all the files within node_modules.

The haste-map built internally by metro currently only has a single flag to control if the entire map is watched. Really this needs to be expanded to have a config to say which folders should be watched, rather than always watching all the roots.
https://github.com/facebook/metro/blob/96fb6e904e1660b37f4d1f5353ca1e5477c4afbf/packages/metro/src/node-haste/DependencyGraph.js#L165

@afoxman afoxman self-assigned this Aug 24, 2021
@afoxman
Copy link
Contributor

afoxman commented Aug 26, 2021

It looks like the roots are derived from the watchFolders property in the Metro configuration. See DependencyGraph._createHaste() where JestHasteMap is instantiated.

We already have a Metro config option for setting which folders are watched. I think what we need is an option to choose what the roots are.

Maybe the roots list is expanded by haste as it runs? It seems to start out OK with just the folders we give it.

@afoxman
Copy link
Contributor

afoxman commented Aug 27, 2021

Confirmed we need a param to control roots explicitly. I will work up a Metro fix and a patch we can use in the meantime.

@afoxman
Copy link
Contributor

afoxman commented Aug 31, 2021

Metro PR has been submitted: facebook/metro#701

@afoxman
Copy link
Contributor

afoxman commented Mar 20, 2022

Going in a different direction with this work. See #1289 for details.

@afoxman afoxman closed this as completed Mar 20, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jun 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature: metro This is related to Metro
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants