Preview: dev server opens unnecessary terminal window on Windows
Description
When using Claude Code's preview feature (preview_start) on Windows, the dev server process spawns a visible terminal window (cmd.exe/conhost) that stays open for the duration of the server. This is unnecessary, disruptive to workflow, and clutters the desktop.
Environment
- OS: Windows 11 Pro 10.0.26200
- Claude Code: Latest (Opus 4.6, 1M context)
- Shell: bash (Git Bash)
- Project: Next.js 15 with App Router
Steps to Reproduce
- Create a
.claude/launch.jsonwith a dev server configuration:
{
"version": "0.0.1",
"configurations": [
{
"name": "Next.js Dev Server",
"runtimeExecutable": "node",
"runtimeArgs": ["node_modules/next/dist/bin/next", "dev"],
"port": 3000
}
]
}
- Call
preview_startwith the server name - A separate terminal window opens and stays visible
Expected Behavior
The dev server process should run in the background without opening a visible terminal window, similar to how VS Code's integrated terminal or other IDEs handle background processes on Windows.
Actual Behavior
A visible next-server (v15.5.14) terminal window opens every time preview_start is called. The user must manually minimize it. If the window is closed, the server dies.
Impact
- Workflow disruption: The terminal window steals focus and covers the IDE
- Desktop clutter: Multiple preview restarts = multiple windows
- Confusion: Users may accidentally close it, killing the server
- Poor DX on Windows: This likely doesn't happen on macOS/Linux where processes can be spawned without a visible window
Possible Solutions
- Use
CREATE_NO_WINDOWorDETACHED_PROCESSflags when spawning the child process on Windows via Node.jschild_process.spawnoptions - Use
windowsHide: trueoption inspawn()/exec()— this is a built-in Node.js option specifically for this purpose - Wrap the process in a way that doesn't require a console window
Workarounds Attempted
- Using
bash -c "node ..."as runtimeExecutable → process dies immediately - Using
npx pnpm dev→ works but adds ~15-20s startup overhead causing preview_screenshot timeouts - Using
nodedirectly → works fast but opens the terminal window
Screenshots
The terminal window that opens:
_A conhost.exe window titled "next-server (v15.5.14)" opens and stays visible during the entire preview session._
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗