fix: switch buttplug WASM to --target web for browser compatibility
--target bundler generates static WASM ESM imports that only work through a bundler. --target web generates fetch-based WASM loading via import.meta.url which browsers handle natively. - Change wasm-pack build target from bundler to web - Call wasmModule.default() (init) after import in maybeLoadWasm - Add .gitignore to exclude dist/ and wasm/ build outputs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -40,7 +40,9 @@ export class ButtplugWasmClientConnector extends EventEmitter implements IButtpl
|
||||
|
||||
private static maybeLoadWasm = async () => {
|
||||
if (ButtplugWasmClientConnector.wasmInstance == undefined) {
|
||||
ButtplugWasmClientConnector.wasmInstance = await import("../wasm/index.js");
|
||||
const wasmModule = await import("../wasm/index.js");
|
||||
await wasmModule.default(); // --target web requires calling init() before using exports
|
||||
ButtplugWasmClientConnector.wasmInstance = wasmModule;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user