Skip to content

chore: pin napi-rs/emnapi versions to prevent WASM runtime mismatch#8982

Draft
shulaoda wants to merge 1 commit intomainfrom
04-01-fix-pin-napi-emnapi-versions
Draft

chore: pin napi-rs/emnapi versions to prevent WASM runtime mismatch#8982
shulaoda wants to merge 1 commit intomainfrom
04-01-fix-pin-napi-emnapi-versions

Conversation

@shulaoda
Copy link
Copy Markdown
Member

@shulaoda shulaoda commented Apr 1, 2026

Summary

  • Add @emnapi/core and @emnapi/runtime as explicit deps of @rolldown/browser (required peer deps of @napi-rs/wasm-runtime)
  • Pin exact versions (remove ^) for @emnapi/core, @emnapi/runtime, @napi-rs/cli, and @napi-rs/wasm-runtime in the pnpm catalog
  • Update knip.jsonc to suppress false-positive unused dependency warnings

Why

The prebuilt WASM addon is compiled against a specific emnapi version by @napi-rs/cli. If users install @rolldown/browser and semver ranges resolve @emnapi/core/@emnapi/runtime to a newer release, the JS runtime won't match the compiled WASM binary — causing errors like Cannot read properties of undefined (reading 'whenLoaded').

See: toyobayashi/emnapi#202

Pinning exact versions ensures the published package always pulls the emnapi version matching the compiled WASM binary, and forces conscious updates when upgrading @napi-rs/cli.

closes #8974, #8978

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 1, 2026

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit 91012c6
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/69cd001a765db70008ba575f
😎 Deploy Preview https://deploy-preview-8982--rolldown-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

Copy link
Copy Markdown
Member

@Brooooooklyn Brooooooklyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using pinned versions, you should run pnpm dedupe --check in Rolldown CI to avoid any duplication of packages.
See https://github.com/voidzero-dev/vite-plus/blob/main/.github/workflows/ci.yml#L181

@shulaoda shulaoda marked this pull request as draft April 1, 2026 12:13
@sapphi-red
Copy link
Copy Markdown
Member

I think pnpm dedupe won't help here. What we want to do here is to sync the versions of @emnapi/core, @emnapi/runtime with the one in @rolldown/bindings-wasm32-wasi. Because @rolldown/bindings-wasm32-wasi is generated at build-time, I think we cannot sync them by pnpm dedupe.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@rolldown/browser must have @emnapi/runtime and @emnapi/core as a dep

3 participants