module: defer ESM bootstrap in pre-execution#61768
Closed
anonrig wants to merge 1 commit intonodejs:mainfrom
Closed
module: defer ESM bootstrap in pre-execution#61768anonrig wants to merge 1 commit intonodejs:mainfrom
anonrig wants to merge 1 commit intonodejs:mainfrom
Conversation
Collaborator
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #61768 +/- ##
=======================================
Coverage 89.74% 89.74%
=======================================
Files 675 675
Lines 204642 204691 +49
Branches 39322 39332 +10
=======================================
+ Hits 183657 183704 +47
- Misses 13257 13278 +21
+ Partials 7728 7709 -19
🚀 New features to boost your workflow:
|
Member
|
I don't think this is a good idea if we are moving towards better ESM support? Generally lazy initialization is reserved for "non essential paths that at least 50% of the application would not hit" (or if it's required mechanically due to cycles), but ESM is probably not going to be that.. |
Member
Author
|
I think you're right @joyeecheung |
This file contains hidden or 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
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.
This change avoids initializing ESM on the default CJS startup path by registering lazy import/import.meta callbacks and only loading the ESM utils when needed. It keeps existing behavior intact (including loader-hook worker and worker/ShadowRealm paths) while reducing boot work for CJS-only runs.
Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1795/