From 2f4898c18d30212da961b28e8d0f3d061cd40682 Mon Sep 17 00:00:00 2001 From: Buffrr Date: Mon, 20 Apr 2026 17:33:55 +0200 Subject: [PATCH] fix(js): handle libveritas default export The published libveritas WASM module self-initializes on import. Its default export is an object, not a callable init function. Only attempt async init when default is actually a function. --- fabric/js/fabric-web/src/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fabric/js/fabric-web/src/index.ts b/fabric/js/fabric-web/src/index.ts index bd6a4f0..37c783d 100644 --- a/fabric/js/fabric-web/src/index.ts +++ b/fabric/js/fabric-web/src/index.ts @@ -7,8 +7,13 @@ import * as libveritas from "@spacesprotocol/libveritas"; export type FabricOptions = Omit; -const wasmInit: (() => Promise) | undefined = - (libveritas as any).default ?? (libveritas as any).init ?? (libveritas as any).__wbg_init; +const wasmInit: (() => Promise) | undefined = (() => { + const d = (libveritas as any).default; + if (typeof d === "function") return d; + if (typeof (libveritas as any).__wbg_init === "function") return (libveritas as any).__wbg_init; + // No async init needed — module self-initializes on import + return undefined; +})(); let wasmReady: Promise | null = null;