Skip to content

fix(dev-server): delegate preview to Nitro when building with Nitro v3 - #2294

Merged
birkskyum merged 3 commits into
solidjs:mainfrom
waterWang:fix/vite-preview-nitro-v3
Aug 18, 2026
Merged

fix(dev-server): delegate preview to Nitro when building with Nitro v3#2294
birkskyum merged 3 commits into
solidjs:mainfrom
waterWang:fix/vite-preview-nitro-v3

Conversation

@waterWang

@waterWang waterWang commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Problem

When using the official Nitro v3 Vite plugin with preset: "node-server", vite preview fails with:

Error: Could not find the SolidStart server entry in <project>/dist/server

SolidStart's configurePreviewServer hook runs before the nitro:preview hook. Since Nitro stores the server entry at .output/server/index.mjs instead of dist/server/entry-server.*, resolvePreviewServerEntry throws, stopping Vite's hook loop before Nitro's hook can handle the request.

Fix

Check for the Nitro build output marker (.output/nitro.json). If present and the file declares a serverEntry, SolidStart skips its own preview middleware and lets the nitro:preview hook handle requests.

Verification

  • vite build + vite preview with Nitro v3 → succeeds (preview delegated to Nitro)
  • vite build + vite preview without Nitro → unchanged behavior (SolidStart middleware still used)
  • No Nitro build → dist/server/entry-server.* checked as before

Fixes #2291

When Nitro controls the production server, its `configurePreviewServer`
hook handles requests. SolidStart's hook runs first and throws because
`dist/server/entry-server.*` does not exist after a Nitro build, which
stops Vite's hook loop before reaching the `nitro:preview` hook.

Detect this by checking for the Nitro build output marker
(`.output/nitro.json`). If present, skip the SolidStart preview
middleware so the Nitro hook can handle preview instead.

Fixes solidjs#2291
@changeset-bot

changeset-bot Bot commented Aug 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 76ad73d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/start Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Aug 16, 2026

Copy link
Copy Markdown

Deploy Preview for solid-start-landing-page ready!

Name Link
🔨 Latest commit 76ad73d
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/6a8433469000ff0008da6d8b
😎 Deploy Preview https://deploy-preview-2294--solid-start-landing-page.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@waterWang waterWang changed the title fix(dev-server): delegate preview to Nitro when building with Nitro v3 [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT] fix(dev-server): delegate preview to Nitro when building with Nitro v3 Aug 16, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/start@2294

commit: 76ad73d

@birkskyum

birkskyum commented Aug 16, 2026

Copy link
Copy Markdown
Member

@naokihaba

naokihaba commented Aug 16, 2026

Copy link
Copy Markdown

Since this PR is marked as Fixes #2291, I would like to clarify the current status.

I opened #2291 to work with the maintainers on determining where and how the issue should be addressed. At the time this PR was opened, that discussion was still in progress and no implementation direction had been agreed upon.

A maintainer has since indicated that the problem may be related to nitrojs/nitro#4509. I have therefore closed #2291 for now to wait for the Nitro-side work and verify it against the original reproduction.

Comment thread packages/start/src/config/dev-server.ts Outdated
@birkskyum
birkskyum merged commit fd5e2ae into solidjs:main Aug 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug?]: Vite preview fails with Nitro v3 because SolidStart looks for dist/server

4 participants