Skip to content

[Documentation] wasmPaths object syntax is wrong #25072

Open
@fdb

Description

@fdb

Describe the documentation issue

The documentation states:

Set env.wasm.wasmPaths to an object with keys as the WebAssembly binary file name and values as the path to the WebAssembly binary file.

// Set separate WebAssembly binary file paths
ort.env.wasm.wasmPaths = {
  'ort-wasm-simd.jsep.wasm': 'https://example.com/path/to/ort-wasm-simd.jsep.wasm'
  'ort-wasm-simd-threaded.jsep.wasm': 'https://example.com/path/to/ort-wasm-simd-threaded.jsep.wasm',
};

However, looking in js/web/lib/wasm/wasm-factory.ts the syntax is different:

  const wasmPaths = flags.wasmPaths;
  const wasmPrefixOverride = typeof wasmPaths === 'string' ? wasmPaths : undefined;
  const mjsPathOverrideFlag = (wasmPaths as Env.WasmFilePaths)?.mjs;
  const mjsPathOverride = (mjsPathOverrideFlag as URL)?.href ?? mjsPathOverrideFlag;
  const wasmPathOverrideFlag = (wasmPaths as Env.WasmFilePaths)?.wasm;
  const wasmPathOverride = (wasmPathOverrideFlag as URL)?.href ?? wasmPathOverrideFlag;
  const wasmBinaryOverride = flags.wasmBinary;

Meaning the syntax should be something like this:

ort.env.wasm.wasmPaths = {
  mjs: `https://cdn.jsdelivr.net/npm/onnxruntime-web@1.22.0/dist/ort-wasm-simd-threaded.jsep.mjs`,
  wasm: `https://cdn.jsdelivr.net/npm/onnxruntime-web@1.22.0/dist/ort-wasm-simd-threaded.jsep.wasm`,
};

Page / URL

https://onnxruntime.ai/docs/tutorials/web/env-flags-and-session-options.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationimprovements or additions to documentation; typically submitted using templateplatform:webissues related to ONNX Runtime web; typically submitted using template

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions