Skip to content

Commit 4808e4d

Browse files
authored
Fix module exports reference generated by asinit (#1325)
1 parent 5ac5841 commit 4808e4d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

NOTICE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ under the licensing terms detailed in LICENSE:
2323
2424
* Julien Letellier <[email protected]>
2525
* Guido Zuidhof <[email protected]>
26+
2627

2728
Portions of this software are derived from third-party works licensed under
2829
the following terms:

bin/asinit

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,9 @@ function ensureIndexJs() {
316316
fs.writeFileSync(indexFile, [
317317
"const fs = require(\"fs\");",
318318
"const loader = require(\"@assemblyscript/loader\");",
319-
"module.exports = loader.instantiateSync(fs.readFileSync(__dirname + \"/build/optimized.wasm\"), { /* imports */ })"
319+
"const imports = { /* imports go here */ };",
320+
"const wasmModule = loader.instantiateSync(fs.readFileSync(__dirname + \"/build/optimized.wasm\"), imports);",
321+
"module.exports = wasmModule.exports;"
320322
].join("\n") + "\n");
321323
console.log(colors.green(" Created: ") + indexFile);
322324
} else {

0 commit comments

Comments
 (0)