env
module isn't imported, using moduleImports
and --importMemory
together
#2823
Labels
env
module isn't imported, using moduleImports
and --importMemory
together
#2823
Bug description
moduleImpors(cases where
@external
ordeclare
are used) together with the--importMemory
flag, the glue code does not include the imports of theenv
module.e.g. build
assembly/index.ts
with the following settings inasconfig.json
.Wasm expects imports for
app.add
andenv.memory
, but in the actual generatedbuild/release.js
, only theapp
module is imported, and the import for theenv
module is missing.While changing
app.add
toenv.add
can circumvent this issue, the desired outcome is to control the size of the memory from outside Wasm.So, the expectation is for code similar to the following to be generated.
export async function instantiate(module, imports = {}) { const __module0 = imports.app; const adaptedImports = { app: __module0, + env: Object.assign(Object.create(globalThis), imports.env || {}), }; const { exports } = await WebAssembly.instantiate(module, adaptedImports); return exports; }
Steps to reproduce
asconfig.json
assembly/index.ts
index.js
Caution
AssemblyScript version
v0.27.24
The text was updated successfully, but these errors were encountered: