Skip to content

Incorrect glue code assembly. Failed to instantiate WASM. #2980

Description

@ZababurinSergei

Bug description

When I compile a WASM module, there are example.js files in the example.wasm folder.

    "example:build:wasm": "asc --config asconfig.json",
Failed to instantiate WASM: TypeError: Cannot read properties of undefined (reading 'memory')
    at _c (example.js:76:26)

There is a line like this in the code

  const { exports } = await WebAssembly.instantiate(module, adaptedImports);

This is not a valid response.
This response is returned.

{
    "module": {},
    "instance": {}
}

exports is always undefined

How to solve this problem?

Steps to reproduce

asconfig.json

{
  "entries": ["./src/assembly/index.ts"],
  "options": {
    "outFile": "./src/module/example.wasm",
    "target": "release",
    "exportRuntime": true,
    "bindings": "raw",
    "disableWarning": [235],
    "optimizeLevel": 3,
    "shrinkLevel": 1,
    "converge": true,
    "noAssert": false,
    "runtime": "stub"
  }
}

asc --config asconfig.json

AssemblyScript version

0.28.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions