Skip to content

Fix Pyodide sandbox on Windows#405

Merged
jlowin merged 1 commit intomainfrom
fix-windows-pyodide-sandbox
Apr 7, 2026
Merged

Fix Pyodide sandbox on Windows#405
jlowin merged 1 commit intomainfrom
fix-windows-pyodide-sandbox

Conversation

@jlowin
Copy link
Copy Markdown
Member

@jlowin jlowin commented Apr 7, 2026

The Pyodide sandbox fails completely on Windows due to three independent issues reported in #393. All three are fixed here, and the Windows skip is removed from CI so they're tested going forward.

CommonJS detection: Deno 2.x needs --unstable-detect-cjs to load Pyodide's npm package, which uses CommonJS modules.

WASM OOM: Pyodide's ~20MB WASM binary exceeds Deno's default V8 heap on Windows. Setting --max-old-space-size=4096 prevents the crash during initialization.

Backslash paths: runner.js uses walk() paths directly for Pyodide's VFS, which only understands forward slashes. On Windows, entry.path contains backslashes, so prefab_ui\components\button.py gets mounted at the wrong path.

// Before:
const relPath = entry.path.slice(prefabSrc.length);
// After:
const relPath = entry.path.slice(prefabSrc.length).replaceAll("\\", "/");

CI now installs Deno on all platforms so the sandbox tests run on Windows.

Closes #393

Add --unstable-detect-cjs flag and DENO_UNSTABLE_DETECT_CJS env var
for Deno 2.x CommonJS compatibility. Set V8 max-old-space-size to
4096MB to prevent WASM OOM during Pyodide init. Normalize backslash
paths in runner.js VFS mounting. Install Deno in CI and remove
Windows skip from sandbox tests.

Closes #393
@marvin-context-protocol marvin-context-protocol Bot added bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. renderer Related to the TypeScript/React renderer. labels Apr 7, 2026
@jlowin jlowin merged commit 84f5de6 into main Apr 7, 2026
8 checks passed
@jlowin jlowin deleted the fix-windows-pyodide-sandbox branch April 7, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. renderer Related to the TypeScript/React renderer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pyodide sandbox fails on Windows — 3 issues (CommonJS, WASM OOM, backslash paths)

1 participant