From 2f43ac02c7aedf4780e55e1651e15f0b42727dc2 Mon Sep 17 00:00:00 2001 From: Raphael Vigee Date: Sat, 24 Oct 2026 21:09:41 +0200 Subject: [PATCH] fix(playground): check the browser can run the VM before downloading Load the VM runtime with Arm64JS.mode() first. It rejects with unsupported-browser where the VM can't run (e.g. Firefox/Safari without cross-origin isolation), so those visitors get the error up front instead of after ~200 MB of heph + plugin downloads. Co-Authored-By: Claude Opus 5.5 --- website/src/components/playground/vm.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/website/src/components/playground/vm.ts b/website/src/components/playground/vm.ts index 132cac9..375a31c 100644 --- a/website/src/components/playground/vm.ts +++ b/website/src/components/playground/vm.ts @@ -194,6 +194,11 @@ export async function bootPlayground( onProgress: (p: Progress) => void, signal: AbortSignal, ): Promise { + // Load the VM runtime first: it rejects with `unsupported-browser` where + // the VM can't run, before a couple hundred MB of downloads. + const { Arm64JS } = await import('arm64js'); + await Arm64JS.mode(); + // --- download, one asset at a time --------------------------------------- const names = [release.binary, ...release.plugins.flatMap((p) => [p.manifest, p.lib])]; const total = names.reduce((n, name) => n + (release.sizes[name] ?? 0), 0);