SharedArrayBuffer is undefined and crossOriginIsolated is false (transformers.js / onnxruntime-web / tfjs WASM stay single-threaded): send COOP + COEP from Vite dev and preview
Fix: send Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp (or credentialless) on the HTML document; in Vite put them in server.headers (dev). vite preview falls back to server.headers when preview.headers is unset (Vite source: headers: preview?.headers ?? server.headers), but your production host (nginx, Netlify _headers, Vercel headers()) needs them separately.
Measured in Chromium: with both headers crossOriginIsolated: true, typeof SharedArrayBuffer === 'function'; without them crossOriginIsolated: false and SharedArrayBuffer is undefined, so threaded WASM backends silently drop to one thread (no error, just slower).
COEP cost: with require-corp, every cross-origin subresource must opt in. fetch() of models from CDNs that send Access-Control-Allow-Origin worked here (jsDelivr, the Hugging Face hub, MediaPipe .task files on storage.googleapis.com); what breaks are no-cors loads such as <img>, <script> without crossorigin, and iframes from hosts that send neither CORS nor Cross-Origin-Resource-Policy: cross-origin. If you can't control those hosts, use Cross-Origin-Embedder-Policy: credentialless (Chromium and Firefox; no-cors requests are sent without cookies instead of being blocked).
Check in DevTools console: crossOriginIsolated must print true on the page that runs the model.