-
Notifications
You must be signed in to change notification settings - Fork 58
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
Hack: patch Metro to not watch files when bundling #873
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 task
marecar3
approved these changes
Apr 15, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hypest LGTM!
Looping back, I brought up here the fact that we're affected by Metro's behavior to always watch the files, even when RN is performing the bundling procedure. |
2 tasks
ceyhun
added a commit
to WordPress/gutenberg
that referenced
this pull request
Jun 25, 2020
This was introduced in wordpress-mobile/gutenberg-mobile#873 as hack to patch metro to not watch files when bundling. Current 0.58.0 version of metro that we are using now automatically checks if it's running on CI via 'ci-info' npm package and doesn't enable watch. See: https://www.npmjs.com/package/ci-info See: https://github.com/facebook/metro/blob/v0.58.0/packages/metro/src/node-haste/DependencyGraph.js#L96
Merged
6 tasks
hypest
pushed a commit
to WordPress/gutenberg
that referenced
this pull request
Jun 26, 2020
…23452) * Print system information * Add debugger to iOS workflow * Remove non-working npm cache clean command * Remove android runner * Install watchman * Bundle iOS 25 times * Bundle iOS 25 times w/o watchman * Bundle iOS 25 times with watchman * Try one last time without watchman * Remove maxWorkers parameter from metro config * Remove metro DependencyGraph.js patch This was introduced in wordpress-mobile/gutenberg-mobile#873 as hack to patch metro to not watch files when bundling. Current 0.58.0 version of metro that we are using now automatically checks if it's running on CI via 'ci-info' npm package and doesn't enable watch. See: https://www.npmjs.com/package/ci-info See: https://github.com/facebook/metro/blob/v0.58.0/packages/metro/src/node-haste/DependencyGraph.js#L96 * Revert "Remove android runner" This reverts commit 51ba723. * Install watchman on both iOS and Android runners * Remove script bundling iOS multiple times * Run React Native E2E tests on pull request instead of push
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We seem to have reached some limits with file watchers in JitPack when building the Android JS bundle there (to use in WPAndroid) and that started after #844 got merged.
See a failed JitPack log here: https://jitpack.io/com/github/wordpress-mobile/gutenberg-mobile/26013ee0d5/build.log
This PR introduces a nasty hack to fix this. I couldn't find a practical way to stop Metro from watching for files while bundling (not even sure why would it need do the watching at that phase, maybe a bug with the React Native bundle command?) and couldn't alter JitPack's default limit for inotify watchers. The hack here is to patch Metro by copying
DependencyGraph.js.patched
over the original, just to change thewatch: true
flag tofalse
.I will re-use the WPAndroid PR (wordpress-mobile/WordPress-Android#9614) to test this out.
To test:
The WPAndroid PR should just be green as the build should succeed.