-
Notifications
You must be signed in to change notification settings - Fork 606
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
feat: load hermes-parser
conditionally when hermes is enabled
#855
Closed
EvanBacon
wants to merge
2
commits into
facebook:main
from
EvanBacon:@evanbacon/optional-hermes-loading
Closed
feat: load hermes-parser
conditionally when hermes is enabled
#855
EvanBacon
wants to merge
2
commits into
facebook:main
from
EvanBacon:@evanbacon/optional-hermes-loading
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
The package `hermes-parser` has a lot of JS that goes unused in web platforms, this leads to increased bundle time.
@robhogan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
robhogan
approved these changes
Aug 22, 2022
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.
Nice 👍
@robhogan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
facebook-github-bot
pushed a commit
that referenced
this pull request
Aug 25, 2022
Summary: - There are [general performance improvements](#855) from conditionally importing Hermes. - `metro-hermes-compiler` is doing some gnarly error handling that makes debugging Metro quite painful. If you get an error in Metro after `metro-hermes-compiler` has been loaded, it will look something like: <img width="1900" alt="Screen Shot 2022-08-23 at 1 28 43 PM" src="https://user-images.githubusercontent.com/9664363/186146899-57817ce9-9cef-439b-a421-98b9aec216fb.png"> This PR doesn't fix the core issue but it does alleviate Metro web and JSC development where Hermes is not used: ``` TypeError [ERR_INVALID_ARG_TYPE]: The "to" argument must be of type string. Received undefined at new NodeError (node:internal/errors:371:5) at validateString (node:internal/validators:119:11) at Object.relative (node:path:1192:5) at MetroTerminalReporter._getBundleStatusMessage (/Users/evanbacon/Documents/GitHub/expo/packages/expo/cli/build/src/start/server/metro/MetroTerminalReporter.js:44:41) at /Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/lib/TerminalReporter.js:393:14 at Array.map (<anonymous>) at MetroTerminalReporter._getStatusMessage (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/lib/TerminalReporter.js:392:8) at MetroTerminalReporter.update (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/lib/TerminalReporter.js:423:31) at Object.update (/Users/evanbacon/Documents/GitHub/expo/packages/expo/cli/build/src/start/server/metro/instantiateMetro.js:21:30) at Server.requestProcessor [as _processBundleRequest] (/Users/evanbacon/Documents/GitHub/metro/packages/metro/src/Server.js:653:22) at async Server._processRequest (/Users/evanbacon/Documents/GitHub/metro/packages/metro/src/Server.js:504:9) ``` Pull Request resolved: #856 Test Plan: Throw an error somewhere in the resolver, Metro will throw a reasonable Node error instead of the Hermes error. Reviewed By: motiz88 Differential Revision: D38940701 Pulled By: cipolleschi fbshipit-source-id: 472fa775c5ae6a39acb6d0195f926a1013a4b425
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.
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.
Summary
The package
hermes-parser
has a lot of JS that goes unused in web platforms, this leads to increased bundle time.Test plan
Before
After