microsoft / microsoft/onnxruntime
[Web] Bundling a package that uses ONNX in a web worker - no error, but doesn't create session / load model
@fs-eire is already working on this.
Since Feb 25, 2026.
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 184
Description
Describe the issue
I'm working on a web package that should use ONNX web from within a web worker.
I have a pnpm monorepo that contains the package and a demo project. The package contains the worker, which is bundled, and then instantiated from the demo project. Both the package and the demo project use vite.
In the worker, I run:
console.log(`Worker: Loading model from ${modelUrl}...`)
const session = await ort.InferenceSession.create(modelUrl, {
executionProviders: ['wasm'],
})
console.log('Worker: Model loaded successfully.', session)
No error is thrown, and in the network tab I see that it is actually fetching the wasm correctly. But only the first message is logged, the second one is never reached. I also see no network request for this modelUrl.
To reproduce
Here's a minimal example of the monorepo described above.
https://github.com/Andonvr/onnx-package-test
Urgency
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.24.2
Execution Provider
'wasm'/'cpu' (WebAssembly CPU)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.