package-template icon indicating copy to clipboard operation
package-template copied to clipboard

Browser Support / Wasm Threading & Cross-Origin Isolation (COI) Failure

Open iteyelmp opened this issue 1 year ago • 0 comments

Hello team,

We are using your NAPI-RS Wasm module and face two major blockers for browser SDK usage:

1. Wasm Threading Requires Unfeasible Server Configuration The module's use of Wasm Threads/SharedArrayBuffer forces the browser to require Cross-Origin Isolation (COI).

Error: DataCloneError: SharedArrayBuffer transfer requires self.crossOriginIsolated.

Impact: This imposes a mandatory COOP/COEP HTTP header setup on all end-users, which is unacceptable for a public SDK.

2. Packaging/Loading Failure Standard bundlers (Vite/Webpack) fail to reliably resolve and load the necessary Wasm binary and its Worker script in the browser environment.

Request for Seamless Browser Solution We need an official strategy to eliminate these deployment blockers. Please provide guidance or a configuration change for NAPI-RS to support one of the following:

A. Max Compatibility Build (No COI Required):

Goal: A non-threaded Wasm build that uses traditional data transfer, allowing the module to work out-of-the-box in any browser environment (no COOP/COEP required).

B. Improved Threaded Distribution:

Goal: A packaging solution that makes the Wasm binary and Worker files seamlessly resolvable by common bundlers, even if COOP/COEP is still required.

Your help in making this module browser-friendly is appreciated.

iteyelmp avatar Dec 01 '25 11:12 iteyelmp