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
+13
View File
@@ -0,0 +1,13 @@
# ADR 0001: Run Piper in an ES module worker
## Decision
Bundle the Piper worker as an ES module and start it with `new Worker(url, { type: 'module' })`.
## Context
Piper loads ONNX Runtime Web and its WebAssembly loader dynamically. The current IIFE/classic worker bundle reports `TypeError: "undefined" cannot be parsed as a URL` during WASM backend initialization, even though the pinned same-origin ONNX loader and binary are available. This is consistent with module-relative URL metadata being lost in the classic bundle.
## Consequences
The browser must support module workers. Current supported browser targets already require modern WebAssembly and worker support. CI asserts that the worker is built and started in module mode; production acceptance remains the real deployed browser flow.