Skip to content

fix(node): record the WASI target on the WebContainer binding fallback - #10952

Merged
shulaoda merged 2 commits into
mainfrom
fix/webcontainer-binding-target
Sep 23, 2026
Merged

shulaoda merged 2 commits into
mainfrom
fix/webcontainer-binding-target

Conversation

@shulaoda

@shulaoda shulaoda commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Fixes #10938

@napi-rs/cli 3.10 (napi-rs/napi-rs#3515, pulled in by #10888) makes every generated loader stamp __napiBindingTarget onto the binding object it returns. The root loader tracks the artifact it resolved in __napiLoadedBindingTarget and throws when the object already carries a different value.

The WebContainer branch is not generated by napi-rs. patchBindingJs() in packages/rolldown/build.ts injects it, and it only assigned nativeBinding, so __napiLoadedBindingTarget stayed at its default 'native'. The downloaded rolldown-binding.wasi.cjs is also a 3.10 loader and had already stamped 'wasm32-wasi' on that object, so the root loader saw two different values and threw.

napi-rs cli 3.10 stamps __napiBindingTarget on every loaded binding and
throws when the root loader's recorded target disagrees. The injected
WebContainer branch never updated the recorded target, so it stayed
'native' while the downloaded WASI loader had already stamped
'wasm32-wasi'. Record the WASI target after the fallback require.

Fixes #10938
@netlify

netlify Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit c78f37c
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6ab33aee7b9f5c00089b04e9
😎 Deploy Preview https://deploy-preview-10952--rolldown-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
c78f37c 2026-09-23T02:38:00.152Z View logs ↗
  • Build: Failed ❌

View logs ↗
39da482 2026-09-22T09:01:09.510Z View logs ↗

@shulaoda
shulaoda marked this pull request as ready for review September 22, 2026 09:03
@shulaoda
shulaoda merged commit 374639e into main Sep 23, 2026
34 of 35 checks passed
@shulaoda
shulaoda deleted the fix/webcontainer-binding-target branch September 23, 2026 02:39
@rolldown-guard rolldown-guard Bot mentioned this pull request Sep 23, 2026
shulaoda added a commit that referenced this pull request Sep 23, 2026
## [1.2.10] - 2026-09-23

### 🚀 Features

- rolldown_plugin_esm_external_require: prefer 'module.exports' over a namespace spread (#10901) by @isker
- watch: support directories in addWatchFile (#10944) by @shulaoda
- label code-splitting timing rows (#10896) by @IWANABETHATGUY
- separate code-splitting group timing rows (#10892) by @IWANABETHATGUY
- clarify callback owners in the timing report (#10890) by @IWANABETHATGUY
- add checks.bundlerTimings with deprecated pluginTimings alias (#10883) by @IWANABETHATGUY

### 🐛 Bug Fixes

- code-splitting: initialize leaves behind a re-exported namespace import (#10694) by @hyfdev
- node: record the WASI target on the WebContainer binding fallback (#10952) by @shulaoda
- dev: force incremental build on in DevEngine::new (#10958) by @o-alexandrov
- tree-shaking: propagate side effects through cycles (#10893) by @IWANABETHATGUY
- deconflict CJS locals that shadow a renamed require wrapper (#10793) by @logaretm
- include group indexes in labeled `codeSplitting` timing rows (#10916) by @IWANABETHATGUY
- docs: type-check Algolia `indices` option (#10934) by @shulaoda
- docs: restore Algolia search (#10929) by @isker
- tell code-splitting timing rows apart by position (#10903) by @IWANABETHATGUY

### 🚜 Refactor

- rolldown_fs_watcher: remove the single-path API (#10950) by @shulaoda
- dev: register watch files through FsWatcher (#10949) by @shulaoda
- watch: let FsWatcher own the watched paths (#10948) by @shulaoda
- watch: identify watch files by normalized absolute path (#10943) by @shulaoda
- plugin: build a plugin-resolved `ResolvedId` in one place (#10921) by @IWANABETHATGUY

### 📚 Documentation

- dev: add HMR design, align dev docs and engine comments (#10271) by @h-a-n-a

### ⚡ Performance

- batch `sourcemapPathTransform` calls (#10763) by @IWANABETHATGUY
- batch `sourcemapIgnoreList` calls (#10762) by @IWANABETHATGUY
- hmr: drop the unused kind argument from registerFactory (#10915) by @h-a-n-a

### 🧪 Testing

- handle Windows paths in sourcemap callback tests (#10942) by @IWANABETHATGUY

### ⚙️ Miscellaneous Tasks

- replace custom `ban-expect-assertions` JS lint with builtin `no-restricted-properties` (#10933) by @isker
- deps: update napi (#10959) by @renovate[bot]
- deps: upgrade oxc to 0.151.0 (#10939) by @camc314
- deps: update test262 submodule for tests (#10941) by @rolldown-guard[bot]
- deps: update npm packages (#10931) by @renovate[bot]
- deps: update napi (#10928) by @renovate[bot]
- deps: update dependency vite-plus to v0.3.3 (#10914) by @renovate[bot]
- deps: update rust crates (#10932) by @renovate[bot]
- deps: update github actions (#10930) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.28.6 (#10924) by @renovate[bot]
- deps: update crate-ci/typos action to v1.50.2 (#10917) by @renovate[bot]
- deps: update dependency @napi-rs/cli to v3.10.4 (#10913) by @renovate[bot]
- deps: update napi (#10897) by @renovate[bot]

### ❤️ New Contributors

* @o-alexandrov made their first contribution in [#10958](#10958)

Co-authored-by: shulaoda <[email protected]>
matthewp added a commit to withastro/astro that referenced this pull request Sep 24, 2026
* fix: require rolldown >=1.2.10 to fix StackBlitz/WebContainer startup

rolldown 1.2.9's WebContainer WASM-binding fallback throws
"__napiBindingTarget is reserved" (rolldown/rolldown#10938), which makes
astro dev/build/info exit silently on StackBlitz. Fixed in rolldown 1.2.10
(rolldown/rolldown#10952). Vite does not yet require it, so astro sets the
floor directly.

* Simplify changeset

* Ignore rolldown in knip (version floor, not imported)
shulaoda added a commit that referenced this pull request Sep 30, 2026
… Node (#10966)

Follow-up to #10952, which fixed #10938.

### Why

The `ci: webcontainer` suite installs `@rolldown/binding-wasm32-wasi`
next to `rolldown`, so the generated loader picks it up before the
WebContainer fallback is reached, and `expectNoRegistryFallback`
deliberately asserts the fallback is not taken. vite.new has no such
package: there `rolldown` loads the binding that
`webcontainer-fallback.cjs` installs, and that path had no coverage at
all. That is how #10938 shipped in 1.2.9.

### What

A third `browser-tests` suite, `webcontainer-fallback`, that runs in
plain Node with no WebContainer:

- installs the packed `rolldown` with optional dependencies disabled, so
no binding of any kind is reachable
- seeds `/tmp/rolldown-<version>` with the packed
`@rolldown/binding-wasm32-wasi`. The fallback skips its registry
download once the entry exists, so the packed binding is what gets
tested, not whatever npm has for this version
- fakes `process.versions.webcontainer`, bundles a small app in a child
process, and asserts that the binding in `require.cache` is the seeded
one

It runs on every PR that touches node code, as a new step in the same
`Browser` job after `just test-browser`. It needs the same wasm build,
which that job already has. Locally: `just test-webcontainer-fallback`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: binding-wasm32-wasi errors __napiBindingTarget is reserved by the generated binding loader, but the loaded binding already exports it

2 participants