fix: copy ort .mjs file, add COOP/COEP headers, set numThreads=1
The threaded ORT WASM requires ort-wasm-simd-threaded.mjs to be served alongside the .wasm files, and needs SharedArrayBuffer (COOP/COEP headers). Add the .mjs to the static copy targets, add the required headers to the Vite dev server, and set ort.env.wasm.numThreads=1 as a single-threaded fallback that avoids the SharedArrayBuffer requirement entirely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,10 @@ export default ({
|
||||
src: "node_modules/onnxruntime-web/dist/*.wasm",
|
||||
dest: "vad",
|
||||
},
|
||||
{
|
||||
src: "node_modules/onnxruntime-web/dist/ort-wasm-simd-threaded.mjs",
|
||||
dest: "vad",
|
||||
},
|
||||
],
|
||||
}),
|
||||
react(),
|
||||
@@ -118,6 +122,11 @@ export default ({
|
||||
key: fs.readFileSync("./backend/dev_tls_m.localhost.key"),
|
||||
cert: fs.readFileSync("./backend/dev_tls_m.localhost.crt"),
|
||||
},
|
||||
// Required for SharedArrayBuffer (used by onnxruntime-web threaded WASM)
|
||||
headers: {
|
||||
"Cross-Origin-Opener-Policy": "same-origin",
|
||||
"Cross-Origin-Embedder-Policy": "require-corp",
|
||||
},
|
||||
},
|
||||
worker: {
|
||||
format: "es",
|
||||
|
||||
Reference in New Issue
Block a user