Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 95f6467

Browse filesBrowse files
bmeckMylesBorins
authored andcommitted
module: fix cyclical dynamic import
ensures that instantiation result is only used during initial loading PR-URL: #18965 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 4b34b2e commit 95f6467
Copy full SHA for 95f6467

File tree

Expand file treeCollapse file tree

2 files changed

+7
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-3
lines changed
Open diff view settings
Collapse file

‎lib/internal/loader/ModuleJob.js‎

Copy file name to clipboardExpand all lines: lib/internal/loader/ModuleJob.js
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ class ModuleJob {
5050
}
5151

5252
async instantiate() {
53-
if (this.instantiated) {
54-
return this.instantiated;
53+
if (!this.instantiated) {
54+
return this.instantiated = this._instantiate();
5555
}
56-
return this.instantiated = this._instantiate();
56+
await this.instantiated;
57+
return this.module;
5758
}
5859

5960
// This method instantiates the module associated with this job and its
Collapse file
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Flags: --experimental-modules
2+
import '../common';
3+
import('./test-esm-cyclic-dynamic-import');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.