Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
fsevents
watcher on Apple silicon (#875)
Summary: If Watchman is unavailable or disabled, we try to fall back to `FSEventsWatcher` and then to `NodeWatcher`. `FSEventsWatcher` is only available on `darwin`, so we `require` it in a try/catch and swallow any error. This was hiding the fact that `fsevents` was also failing to load on Apple silicon: ``` dlopen(/Users/robhogan/gh/metro/node_modules/fsevents/fsevents.node, 0x0001): tried: '/Users/robhogan/gh/metro/node_modules/fsevents/fsevents.node' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))) ``` `fsevents@2.3` introduces support for Apple silicon. This updates to that version, and also adds Flow types based on the TypeScript types bundled with `fsevents` so that Flow check passes on `darwin` (the Flow error was `untyped-import` so the existing `cannot-resolve-module` suppression doesn't work). Pull Request resolved: #875 Test Plan: ### After: ``` $ node packages/metro/src/cli serve -c ../dummyproj/metro.config.js ▒▒▓▓▓▓▒▒ ▒▓▓▓▒▒░░▒▒▓▓▓▒ ▒▓▓▓▓░░░▒▒▒▒░░░▓▓▓▓▒ ▓▓▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▓▓ ▓▓░░░░░▒▓▓▓▓▓▓▒░░░░░▓▓ ▓▓░░▓▓▒░░░▒▒░░░▒▓▒░░▓▓ ▓▓░░▓▓▓▓▓▒▒▒▒▓▓▓▓▒░░▓▓ ▓▓░░▓▓▓▓▓▓▓▓▓▓▓▓▓▒░░▓▓ ▓▓▒░░▒▒▓▓▓▓▓▓▓▓▒░░░▒▓▓ ▒▓▓▓▒░░░▒▓▓▒░░░▒▓▓▓▒ ▒▓▓▓▒░░░░▒▓▓▓▒ ▒▒▓▓▓▓▒▒ Welcome to Metro v0.72.3 Fast - Scalable - Integrated Metro:FSEventsWatcher Watching /Users/robhogan/gh/dummyproj +0ms ``` Reviewed By: huntie Differential Revision: D39883504 Pulled By: huntie fbshipit-source-id: 223a390715f13f32cdc1788185c75a96433581de
- Loading branch information