Repository navigation
Description
Describe the bug
The Vite+ CLI cannot start in a StackBlitz WebContainer.
A minimal project containing only [email protected] fails when it runs vp --version or vp env current. Both commands exit while loading vite-plus/binding/index.cjs, before Vite+ processes the command.
The platform-specific native binding cannot load in the WebContainer. The generated loader then checks for these WASI bindings:
./vite-plus.wasi.cjs@voidzero-dev/vite-plus-wasm32-wasi
Neither option is available:
- The published
[email protected]package contains no local WASI loader or.wasmartifact. - The npm registry returns 404 for
@voidzero-dev/vite-plus-wasm32-wasi.
Expected: Vite+ loads a compatible WASI binding and runs vp commands in the WebContainer.
Actual: Vite+ exits with Cannot find native binding.
The missing WASI distribution can also be reproduced deterministically on macOS:
NAPI_RS_FORCE_WASI=error ./node_modules/.bin/vp --versionThat command reports both missing WASI options:
Error: WASI binding not found and NAPI_RS_FORCE_WASI is set to error
Cause 1:
Error: Cannot find module '@voidzero-dev/vite-plus-wasm32-wasi'
Cause 2:
Error: Cannot find module './vite-plus.wasi.cjs'
Normal macOS execution succeeds with the native binding. The forced command isolates the unavailable WASI distribution; it does not indicate a problem with the macOS native binding.
Source references
The current generated loader documents WASI as its fallback:
vite-plus/packages/cli/binding/index.cjs
Lines 733 to 742 in d3bc20a
| // NAPI_RS_FORCE_WASI is a tri-state flag: | |
| // unset / any other value → native binding preferred, WASI is only a fallback | |
| // 'true' → prefer WASI, but retain native as a lazy fallback | |
| // 'error' → require WASI without initializing a native fallback | |
| // Treating any non-empty string as truthy (the historical behavior) meant | |
| // NAPI_RS_FORCE_WASI=false, NAPI_RS_FORCE_WASI=0, etc. inadvertently triggered | |
| // the WASI path, causing ENOENT for packages shipped without a .wasi.cjs file. | |
| // | |
| // NAPI_RS_WASI_FLAVOR selects one exact generated flavor and implies strict | |
| // WASI loading. It never crosses into another flavor or falls back to native. |
It first tries the bundled ./vite-plus.wasi.cjs loader and its .wasm artifacts:
vite-plus/packages/cli/binding/index.cjs
Lines 807 to 829 in d3bc20a
| if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) { | |
| let candidateError = null; | |
| let candidateFailed = false; | |
| try { | |
| candidateError = __napiWasiResolveCandidate('./vite-plus.wasi.cjs', false, [ | |
| './vite-plus.wasm32-wasi.debug.wasm', | |
| './vite-plus.wasm32-wasi.wasm', | |
| ]); | |
| candidateFailed = candidateError !== null; | |
| if (!candidateFailed) { | |
| wasiBinding = require('./vite-plus.wasi.cjs'); | |
| nativeBinding = wasiBinding; | |
| wasiBindingLoaded = true; | |
| } | |
| } catch (err) { | |
| candidateError = err; | |
| candidateFailed = true; | |
| } | |
| if (candidateFailed) { | |
| wasiBindingErrors.push(candidateError); | |
| loadErrors.push(candidateError); | |
| } | |
| } |
It then tries @voidzero-dev/vite-plus-wasm32-wasi:
vite-plus/packages/cli/binding/index.cjs
Lines 830 to 865 in d3bc20a
| if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) { | |
| let candidateError = null; | |
| let candidateFailed = false; | |
| try { | |
| candidateError = __napiWasiResolveCandidate( | |
| '@voidzero-dev/vite-plus-wasm32-wasi', | |
| true, | |
| undefined, | |
| ); | |
| candidateFailed = candidateError !== null; | |
| if (!candidateFailed) { | |
| if ( | |
| process.env.NAPI_RS_ENFORCE_VERSION_CHECK && | |
| process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0' | |
| ) { | |
| const bindingPackageVersion = | |
| require('@voidzero-dev/vite-plus-wasm32-wasi/package.json').version; | |
| if (bindingPackageVersion !== '0.3.0') { | |
| throw new Error( | |
| `WASI binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`, | |
| ); | |
| } | |
| } | |
| wasiBinding = require('@voidzero-dev/vite-plus-wasm32-wasi'); | |
| nativeBinding = wasiBinding; | |
| wasiBindingLoaded = true; | |
| } | |
| } catch (err) { | |
| candidateError = err; | |
| candidateFailed = true; | |
| } | |
| if (candidateFailed) { | |
| wasiBindingErrors.push(candidateError); | |
| loadErrors.push(candidateError); | |
| } | |
| } |
When WASI is required and neither option can load, it throws the forced-WASI error:
vite-plus/packages/cli/binding/index.cjs
Lines 869 to 876 in d3bc20a
| if ((forceWasiError || __napiWasiFlavorRequested) && !wasiBindingLoaded) { | |
| const error = new Error( | |
| __napiWasiFlavorRequested | |
| ? 'WASI binding for flavor "' + __napiWasiFlavor + '" not found' | |
| : 'WASI binding not found and NAPI_RS_FORCE_WASI is set to error', | |
| ); | |
| error.cause = createLoadErrorChain(wasiBindingErrors); | |
| throw error; |
Related findings
- Avoid circular binding resolution between vite-plus-core and vite-plus #2054 concerns circular binding resolution between
vite-plus-coreandvite-plus. This report concerns the unavailable WASI distribution for the Vite+ CLI itself. - fix(core): resolve Rolldown bindings via platform packages #2067 proposed resolving Rolldown bindings through platform packages and explicitly left unsupported or fallback WASI bindings unchanged. The PR was closed without merging.
This prevents projects that use Vite+ commands from running in StackBlitz WebContainers. The reproduction contains no application code and fails with vp --version alone.
I am not currently planning a PR.
Reproduction
Steps to reproduce
- Open the StackBlitz reproduction.
- Wait for StackBlitz to install the dependencies.
- StackBlitz automatically runs
pnpm run reproduce, which invokesvp --version. - Observe that Vite+ exits while loading its native binding.
- Run
pnpm run environmentin the terminal. - Observe that
vp env currentfails during the same binding-loading step.
To isolate the unavailable WASI distribution on macOS:
- Clone https://github.com/ueberBrot/vite-plus-webcontainer-repro.
- Run
pnpm install. - Run
pnpm run reproduce:wasi. - Observe that Vite+ cannot find either
./vite-plus.wasi.cjsor@voidzero-dev/vite-plus-wasm32-wasi.
System Info
StackBlitz WebContainer
$ node --version
v22.22.3
$ pnpm --version
8.15.6
$ pnpm run environment
> [email protected] environment /home/ueberBrot/vite-plus-webcontainer-repro
> vp env current
ELIFECYCLE Command failed with exit code 1.
Error: Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
at Object.eval (/home/ueberBrot/vite-plus-webcontainer-repro/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plus/binding/index.cjs:882:19)
at Module._compile (node:internal/modules/cjs/loader:160:19302)
at Module._extensions..js (node:internal/modules/cjs/loader:160:20043)
at Module.load (node:internal/modules/cjs/loader:160:17661)
at Module._load (node:internal/modules/cjs/loader:160:15179)
at wrapModuleLoad (node:internal/modules/cjs/loader:160:4199)
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:174:3866)
at _0x504db8.evaluationFunction (node:internal/modules/esm/translators:174:3603)
Node.js v22.22.3
$ pnpm run reproduce
> [email protected] reproduce /home/ueberBrot/vite-plus-webcontainer-repro
> vp --version
ELIFECYCLE Command failed with exit code 1.
Error: Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
at Object.eval (/home/ueberBrot/vite-plus-webcontainer-repro/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plus/binding/index.cjs:882:19)
at Module._compile (node:internal/modules/cjs/loader:160:19302)
at Module._extensions..js (node:internal/modules/cjs/loader:160:20043)
at Module.load (node:internal/modules/cjs/loader:160:17661)
at Module._load (node:internal/modules/cjs/loader:160:15179)
at wrapModuleLoad (node:internal/modules/cjs/loader:160:4199)
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:174:3866)
at _0x504db8.evaluationFunction (node:internal/modules/esm/translators:174:3603)
Node.js v22.22.3Used Package Manager
pnpm
Logs
Local diagnostic environment:
macOS 26.6.2
Architecture: arm64
Node.js v24.18.0
vite-plus v0.3.0
$ NAPI_RS_FORCE_WASI=error node -e 'try { require("./node_modules/vite-plus/binding/index.cjs") } catch (error) { let current = error; let index = 0; while (current) { console.error("Cause " + index + ":"); console.error(current.stack || String(current)); current = current.cause; index += 1; } process.exit(1); }'
Cause 0:
Error: WASI binding not found and NAPI_RS_FORCE_WASI is set to error
at Object.<anonymous> (/private/tmp/vite-plus-webcontainer-repro.9X28Wk/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plus/binding/index.cjs:870:19)
at Module._compile (node:internal/modules/cjs/loader:1871:14)
at Object..js (node:internal/modules/cjs/loader:2002:10)
at Module.load (node:internal/modules/cjs/loader:1594:32)
at Module._load (node:internal/modules/cjs/loader:1396:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
at Module.require (node:internal/modules/cjs/loader:1617:12)
at require (node:internal/modules/helpers:153:16)
at [eval]:1:7
at runScriptInThisContext (node:internal/vm:219:10)
Cause 1:
Error: Cannot find module '@voidzero-dev/vite-plus-wasm32-wasi'
Require stack:
- /private/tmp/vite-plus-webcontainer-repro.9X28Wk/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plus/binding/index.cjs
- /private/tmp/vite-plus-webcontainer-repro.9X28Wk/[eval]
at /private/tmp/vite-plus-webcontainer-repro.9X28Wk/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plus/binding/index.cjs:727:19
at Array.reduce (<anonymous>)
at createLoadErrorChain (/private/tmp/vite-plus-webcontainer-repro.9X28Wk/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plus/binding/index.cjs:720:17)
at Object.<anonymous> (/private/tmp/vite-plus-webcontainer-repro.9X28Wk/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plus/binding/index.cjs:875:19)
at Module._compile (node:internal/modules/cjs/loader:1871:14)
at Object..js (node:internal/modules/cjs/loader:2002:10)
at Module.load (node:internal/modules/cjs/loader:1594:32)
at Module._load (node:internal/modules/cjs/loader:1396:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
at Module.require (node:internal/modules/cjs/loader:1617:12)
Cause 2:
Error: Cannot find module './vite-plus.wasi.cjs'
Require stack:
- /private/tmp/vite-plus-webcontainer-repro.9X28Wk/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plus/binding/index.cjs
- /private/tmp/vite-plus-webcontainer-repro.9X28Wk/[eval]
at /private/tmp/vite-plus-webcontainer-repro.9X28Wk/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plus/binding/index.cjs:727:19
at Array.reduce (<anonymous>)
at createLoadErrorChain (/private/tmp/vite-plus-webcontainer-repro.9X28Wk/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plus/binding/index.cjs:720:17)
at Object.<anonymous> (/private/tmp/vite-plus-webcontainer-repro.9X28Wk/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plus/binding/index.cjs:875:19)
at Module._compile (node:internal/modules/cjs/loader:1871:14)
at Object..js (node:internal/modules/cjs/loader:2002:10)
at Module.load (node:internal/modules/cjs/loader:1594:32)
at Module._load (node:internal/modules/cjs/loader:1396:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
at Module.require (node:internal/modules/cjs/loader:1617:12)Validations
- Read the Contributing Guidelines.
- Check that there isn't already an issue for the same bug.
- Confirm this is a Vite+ issue and not an upstream issue (Vite, Vitest, tsdown, Rolldown, or Oxc).
- The provided reproduction is a minimal reproducible example.
Metadata
Metadata
Assignees
Type
Fields
Priority
Effort
Target date
Start date
Activity
fengmk2 commentedon Sep 17, 2026
I think we need to wait for vite-task support wasm first. cc @wan9chi
filipfalcon commentedon Sep 29, 2026
This is still an issue in 1.0.0.
For context: I'm moving Foldkit and its
create-foldkit-appscaffold to Vite+ (foldkit/foldkit#1477). The docs run every example as a live playground in a WebContainer, so those playgrounds have to stay on plain Vite until Vite+ can run there. With 1.0 out, WebContainer support is the one gap keeping Foldkit from using Vite+ everywhere.Is there an issue for WASM support in vite-task that I can follow, or a rough idea of where it sits on the roadmap?
chore(deps): update rust crates (#1780)
addpatch: yaak 2026.9.0-1