diff options
Diffstat (limited to 'std/bundle/utils.ts')
-rw-r--r-- | std/bundle/utils.ts | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/std/bundle/utils.ts b/std/bundle/utils.ts index 91c0820bf..062c62231 100644 --- a/std/bundle/utils.ts +++ b/std/bundle/utils.ts @@ -70,18 +70,20 @@ export function instantiate( assert(module != null); assert(module.factory != null); - const dependencies = module.dependencies.map((id): object => { - if (id === "require") { - // TODO(kitsonk) support dynamic import by passing a `require()` that - // can return a local module or dynamically import one. - return (): void => {}; - } else if (id === "exports") { - return module.exports; + const dependencies = module.dependencies.map( + (id): object => { + if (id === "require") { + // TODO(kitsonk) support dynamic import by passing a `require()` that + // can return a local module or dynamically import one. + return (): void => {}; + } else if (id === "exports") { + return module.exports; + } + const dep = modules.get(id)!; + assert(dep != null); + return dep.exports; } - const dep = modules.get(id)!; - assert(dep != null); - return dep.exports; - }); + ); if (typeof module.factory === "function") { module.factory!(...dependencies); |