Skip to content

@rolldown/binding-wasm32-wasi 1.2.9 failing due to WASI binding error #2167

Description

@AllanJard

Describe the bug

I've just been trying to run a Vite 8 project in Stackblitz but it will always fail with a WASI error. Specifically, Vite 8 uses rolldown, and @rolldown/binding-wasm32-wasi @1.2.9 is installed, but it results in the following:

❯ npm install && npm run dev

added 18 packages in 6s

9 packages are looking for funding
  run `npm fund` for details

> vite-typescript-starter@0.0.0 dev
> vite

[rolldown] Downloading @rolldown/binding-wasm32-wasi@1.2.9 on WebContainer...
Packages: +7
+++++++
Progress: resolved 7, reused 0, downloaded 7, added 7, done

dependencies:
+ @rolldown/binding-wasm32-wasi 1.2.9

Done in 6.9s
(node:12) ExperimentalWarning: WASI is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Error: `__napiBindingTarget` is reserved by the generated binding loader, but the loaded binding already exports it. Rename the export, e.g. #[napi(js_name = "...")].
    at __napiStampBindingTarget (file:///home/projects/vitejs-vite-appanczj/node_modules/rolldown/dist/shared/binding-BbrDfv1x.mjs:627:34)
    at <anonymous> (file:///home/projects/vitejs-vite-appanczj/node_modules/rolldown/dist/shared/binding-BbrDfv1x.mjs:642:39)
    at <anonymous> (file:///home/projects/vitejs-vite-appanczj/node_modules/rolldown/dist/shared/binding-BbrDfv1x.mjs:25:49)
    at <anonymous> (file:///home/projects/vitejs-vite-appanczj/node_modules/rolldown/dist/shared/parse-DltPb1DL.mjs:19:84)
    at run (node:internal/modules/esm/module_job:170:4963) {
  code: 'ERR_NAPI_BINDING_TARGET_CONFLICT'
}

Node.js v22.22.3

~/projects/vitejs-vite-appanczj 15s

This is the link to that example. You can also use the links on the Vite page to create a starter package.

It does appear that pinning @rolldown/binding-wasm32-wasi to 1.2.4 works around it, so it is unclear to me if the issue is actually in rolldown, or if it is here in webcontainer core's WASM interface. I'm taking a punt and guessing here, but my apologies if it should be else where. I have tried to search in both projects for this issue, and am surprised that I can't see it raised, given how proponent those links are on the Vite.dev getting started page. Again my apologies if it is a duplicate that I haven't see.

Link to the blitz that caused the error

https://stackblitz.com/edit/vitejs-vite-appanczj?file=index.html&terminal=dev

Steps to reproduce

  1. Go to the linked blitz
  2. Let npm install run
  3. Note the error

Expected behavior

If you download the package and run npm install locally it will run without issue. This is the expected behaviour.

Parity with Local

Screenshots

No response

Platform

Browser name  = Firefox
Full version  = 153.0
Major version = 153
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (X11; Linux x86_64; rv:153.0) Gecko/20100101 Firefox/153.0
performance.memory = undefined
Hash = d5306e6f

Also tested on Chrome, and the same error occurs.

Additional context

No response

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions