Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit 9ab7cfc

Browse files
committed
Fix load already loading #254
1 parent 20a08b5 commit 9ab7cfc

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/loader.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ function logloads(loads) {
174174
load = createLoad(name);
175175
load.status = 'linked';
176176
// https://bugs.ecmascript.org/show_bug.cgi?id=2795
177-
// load.module = loader.modules[name];
177+
load.module = loader.modules[name];
178178
return load;
179179
}
180180

@@ -250,7 +250,7 @@ function logloads(loads) {
250250
if (instantiateResult === undefined) {
251251
load.address = load.address || '<Anonymous Module ' + ++anonCnt + '>';
252252

253-
// NB instead of load.kind, use load.isDeclarative
253+
// instead of load.kind, use load.isDeclarative
254254
load.isDeclarative = true;
255255
// parse sets load.declare, load.depsList
256256
loader.loaderObj.parse(load);
@@ -342,12 +342,10 @@ function logloads(loads) {
342342
if (loader.modules[name])
343343
throw new TypeError('"' + name + '" already exists in the module table');
344344

345-
// NB this still seems wrong for LoadModule as we may load a dependency
346-
// of another module directly before it has finished loading.
347-
// see https://bugs.ecmascript.org/show_bug.cgi?id=2994
345+
// adjusted to pick up existing loads
348346
for (var i = 0, l = loader.loads.length; i < l; i++)
349347
if (loader.loads[i].name == name)
350-
throw new TypeError('"' + name + '" already loading');
348+
return resolve(loader.loads[i].linkSets[0].done);
351349

352350
var load = createLoad(name);
353351

0 commit comments

Comments
 (0)