Skip to content

test:compiler --wasm fails for the WASM-compiled compiler with Unknown file extension ".wasm" #2684

Closed
@caer

Description

@caer

Bug description

Running npm run test:compiler -- --wasm build/assemblyscript.release-bootstrap.wasm on a clean version of the repository after following the steps here fails with the following error:

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".wasm" for /home/../assemblyscript/build/assemblyscript.release-bootstrap.wasm
    at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
    at new NodeError (node:internal/errors:399:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:74:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:114:38)
    at defaultLoad (node:internal/modules/esm/load:81:20)
    at nextLoad (node:internal/modules/esm/loader:163:28)
    at ESMLoader.load (node:internal/modules/esm/loader:597:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:449:22)
    at new ModuleJob (node:internal/modules/esm/module_job:63:26)
    at #createModuleJob (node:internal/modules/esm/loader:472:17)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:426:34) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

Is this a known/common issue, and is there any resolution for it?

I did notice that the roadmap lists Compile the AssemblyScript compiler to WebAssembly using itself as an incomplete work item. Does this roadmap entry imply that running the compiler in WASM isn't currently supported?

Steps to reproduce

Here's a minimal Dockerfile which reproduces the error:

FROM node:19

# Clone the ASC repo, checking out the current HEAD
# commit at the time of writing this bug.
RUN git clone https://github.com/AssemblyScript/assemblyscript
WORKDIR assemblyscript
RUN git checkout 77d0af2b578c0619bce68594d80778f2f3ec0e33

# Prepare development tooling.
RUN npm install

# Compile the compiler to WASM and test it.
RUN npm run build
RUN npm run bootstrap
RUN npm run test:compiler -- --wasm build/assemblyscript.release-bootstrap.wasm

These steps should be equivalent to the ones documented in the repo.

AssemblyScript version

v0.27.2

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