Skip to content

fix(ruvector): make createEmbedder() init WASM correctly under Node (…#533

Open
as473 wants to merge 1 commit into
ruvnet:mainfrom
as473:fix/onnx-createEmbedder-node-init
Open

fix(ruvector): make createEmbedder() init WASM correctly under Node (…#533
as473 wants to merge 1 commit into
ruvnet:mainfrom
as473:fix/onnx-createEmbedder-node-init

Conversation

@as473
Copy link
Copy Markdown

@as473 as473 commented Jun 3, 2026

#523)

The bundler-target wasm-pack wrapper (pkg/ruvector_onnx_embeddings_wasm.js) starts with import * as wasm from "...bg.wasm" (unresolvable in plain Node ESM) and exports no default init, so createEmbedder()'s old import(wrapper); await default() path threw m.default is not a function under Node.

Mirror the proven worker init (embed-worker.mjs): import the _bg.js glue directly and instantiate the .wasm via WebAssembly.instantiate, Node-guarded. The browser/bundler default() path is preserved. Vectors are identical to the worker path by construction.

…uvnet#523)

The bundler-target wasm-pack wrapper (pkg/ruvector_onnx_embeddings_wasm.js)
starts with `import * as wasm from "...bg.wasm"` (unresolvable in plain Node
ESM) and exports no `default` init, so createEmbedder()'s old
`import(wrapper); await default()` path threw `m.default is not a function`
under Node.

Mirror the proven worker init (embed-worker.mjs): import the _bg.js glue
directly and instantiate the .wasm via WebAssembly.instantiate, Node-guarded.
The browser/bundler default() path is preserved. Vectors are identical to the
worker path by construction.
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.

1 participant