microsoft / microsoft/onnxruntime

[Web] Bundling a package that uses ONNX in a web worker - no error, but doesn't create session / load model

Open
#27,429 3 comments 0 reactions 1 assignee View on GitHub

@fs-eire is already working on this.

Since Feb 25, 2026.

platform:web
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.