Skip to content

Failed to initialize LuaFactory in Vercel with custom wasm file path. #118

Description

@pureliumy

Problem
Failed to initialize LuaFactory in Vercel with custom wasm file path.

Demo code

// This way we could load the wasm file in Vercel production environment.
const luaWasmFile = path.resolve('public/lib/glue.wasm');
const factory = new LuaFactory(luaWasmFile);

Error output

failed to asynchronously prepare wasm: TypeError: WebAssembly.instantiate(): Import #0 module="env" error: module is not an object or function

Remarks
I don't know whether it is related to the file import method or not, but I have tried many ways, only the above way worked in Vercel production environment.

/**
 * These didn't work in Vercel production environment, luaWasmFile will be not found.
 * 
 * 1. https://vercel.com/docs/functions/wasm
 * 2. https://github.com/Drumsin/aoe4-generated-map-debugger/pull/6/files
 */

import luaWasmFile from 'wasmoon/dist/glue.wasm';
const factory = new LuaFactory(luaWasmFile);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions