Preview: dev server opens unnecessary terminal window on Windows

Resolved 💬 3 comments Opened Mar 26, 2026 by phasprofissional-arch Closed Mar 29, 2026

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

  1. Create a .claude/launch.json with 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
    }
  ]
}
  1. Call preview_start with the server name
  2. 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

  1. Use CREATE_NO_WINDOW or DETACHED_PROCESS flags when spawning the child process on Windows via Node.js child_process.spawn options
  2. Use windowsHide: true option in spawn()/exec() — this is a built-in Node.js option specifically for this purpose
  3. 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 node directly → works fast but opens the terminal window

Screenshots

The terminal window that opens:

!Terminal window

_A conhost.exe window titled "next-server (v15.5.14)" opens and stays visible during the entire preview session._

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗