til/sandpack-console-needs-a-client.mdtil
date
2026-11-10
tags
[sandpack, react]

TIL

Sandpack's console prints nothing without a preview

<SandpackConsole> only shows logs from a running client, and the client normally lives inside <SandpackPreview>. Hide the preview and the code never runs, so the console stays empty.

The fix is the standalone prop, which gives the console its own client:

<SandpackConsole standalone={!showPreview} />

↑↓ select ↵ open esc close