Run Piper ONNX in a module worker
Build and publish frontend / publish (push) Successful in 46s

This commit is contained in:
Ein Anderssono
2026-10-16 07:45:21 +02:00
parent 874b9be841
commit d26d7f0b55
5 changed files with 31 additions and 3 deletions
+3 -1
View File
@@ -6,7 +6,9 @@ const pending = new Map();
function getWorker() {
if (worker) return worker;
worker = new Worker(workerUrl);
// ONNX Runtime resolves its WASM loader relative to the worker module URL.
// Keep the worker as ESM so import.meta.url remains available at runtime.
worker = new Worker(workerUrl, {type: 'module'});
worker.onmessage = event => {
const message = event.data || {};
const request = pending.get(message.id);