microsoft / microsoft/onnxruntime
[Documentation] wasmPaths object syntax is wrong
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 184
Description
### 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:
```ts
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:
```js
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
Contributor guide
Research direction
Open the env-flags-and-session-options documentation page and compare its wasmPaths example with js/web/lib/wasm/wasm-factory.ts, especially the mjs and wasm fields. Update the example and accompanying explanation to match the supported object syntax, then verify that the JavaScript example is syntactically valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, wasm
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100