Metro seems to leave orphaned watchman watches frequently
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?
Frequently, when running my app via yarn ios, the launched metro process immediately shows the following:
watchman warning: Recrawled this watch 15 times, most recently because:
MustScanSubDirs UserDroppedTo resolve, please review the information on
https://facebook.github.io/watchman/docs/troubleshooting.html#recrawl
To clear this warning, run:
`watchman watch-del '/Users/swrobel/Code/bakesy-apps' ; watchman watch-project '/Users/swrobel/Code/bakesy-apps'`
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.
Unfortunately there doesn't seem to be an easy repro as I'm not sure what triggers these orphaned watchman processes (or at least that's my assumption of what's happening)
What is the expected behavior?
Metro avoids these situations altogether, or barring that, automatically clears the old watches and creates new ones upon startup instead of just printing this message which isn't really relevant as far as I can tell (would running watchman watch-project in a separate terminal even work correctly?)
Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
yarn 1.22.18
node 16.15.0
Metro 0.67.0
metro.config.js:
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
// Work around Metro bug with cjs files
// https://github.com/facebook/metro/issues/535#issuecomment-970443661
const defaultSourceExts = require('metro-config/src/defaults/defaults').sourceExts
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
resolver: {
sourceExts: process.env.RN_SRC_EXT
? [...process.env.RN_SRC_EXT.split(',').concat(defaultSourceExts), 'cjs']
: [...defaultSourceExts, 'cjs'],
},
}
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 warning when launching the app with yarn ios, using the reported Metro 0.67.0, Node 16.15.0, and metro.config.js. Trace Metro's startup handling of Watchman watches and compare it with the reported watch-del and watch-project commands. Done means Metro no longer leaves orphaned watches or handles them automatically without the recurring warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100