Repository navigation
[Bug?]: Vite preview fails with Nitro v3 because SolidStart looks for dist/server #2291
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
I’d appreciate the maintainers’ guidance on the preferred approach here. If the analysis and proposed direction below look correct,
I’d be happy to contribute a fix.
I am a member of the Vite+ team. I found this issue while investigating a bug reported here:
voidzero-dev/vite-plus#2416
The same behavior is reproducible with both Vite+ and official Vite:
- Vite+ reproduction: https://github.com/naokihaba/repro-vite-plus-2416
- Official Vite reproduction: https://github.com/naokihaba/repro-vite-plus-2416-plain-vite
The official Vite reproduction uses vite@8.2.0 and does not have either vite-plus or @voidzero-dev/vite-plus-core installed.
vite build succeeds and generates the Nitro server entry at:
.output/server/index.mjs
Nitro records this entry in .output/nitro.json:
{
"serverEntry": "server/index.mjs",
"commands": {
"preview": "node ./server/index.mjs"
}
}However, vite preview fails with the following error:
error when starting preview server:
Error: Could not find the SolidStart server entry in <project>/dist/server
The stack trace points to SolidStart's resolvePreviewServerEntry:
at resolvePreviewServerEntry (.../@solidjs/start/dist/config/dev-server.js:108:15)
at configurePreviewServer (.../@solidjs/start/dist/config/dev-server.js:20:54)
at preview (.../vite/dist/node/chunks/node.js:...)
SolidStart's resolvePreviewServerEntry only searches for:
dist/server/entry-server.js
dist/server/entry-server.mjs
Relevant implementation:
https://github.com/solidjs/solid-start/blob/main/packages/start/src/config/dev-server.ts
Both SolidStart and Nitro register a configurePreviewServer hook. The resolved hook order is:
solid-start-dev-server
nitro:preview
SolidStart's hook runs first and throws an error because dist/server/entry-server.* does not exist. This stops Vite's hook loop before reaching Nitro's preview hook.
I have shared the detailed investigation here:
voidzero-dev/vite-plus#2416 (comment)
Expected behavior 🤔
When Nitro's Vite plugin controls the production server, SolidStart's preview hook should not require its standalone dist/server/entry-server.* output.
Instead, vite preview should delegate preview handling to Nitro and serve the generated .output/server/index.mjs build.
Steps to reproduce 🕹
Reproduction using official Vite:
https://github.com/naokihaba/repro-vite-plus-2416-plain-vite
Steps:
-
Clone the reproduction:
git clone https://github.com/naokihaba/repro-vite-plus-2416-plain-vite.git cd repro-vite-plus-2416-plain-vite -
Install dependencies:
pnpm install
-
Build the application:
pnpm build
The build succeeds and generates
.output/server/index.mjs. -
Start the preview server:
pnpm preview
Preview fails while looking for
dist/server/entry-server.*.
The generated Nitro server works when started directly:
pnpm startContext 🔦
This was initially reported as a Vite+ bug. I investigated it as a member of the Vite+ team and created a control reproduction using official vite@8.2.0.
Because the same failure occurs without Vite+, this appears to be an integration issue between SolidStart's preview hook and Nitro's preview handling.
SolidStart's configureServer hook already avoids taking control when another plugin manages the development server:
if ("dispatchFetch" in serverEnv) return;
// another plugin is controlling the dev server
if (!isRunnableDevEnvironment(serverEnv)) {
return;
}I think configurePreviewServer needs equivalent delegation or skip behavior when Nitro controls preview.
The exact configureServer condition may not be directly reusable because the preview hook does not necessarily expose the same runtime environment. The important behavior is that SolidStart should avoid resolving dist/server/entry-server.* when another plugin, such as Nitro, owns the preview server.
Your environment 🌎
System:
OS: macOS 26.5.2
CPU: arm64
Binaries:
Node: 24.19.0
pnpm: 11.21.0
npmPackages:
@solidjs/start: 2.0.0
nitro: 3.0.260610-beta
solid-js: 1.9.14
vite: 8.2.0
Activity
birkskyum commentedon Aug 16, 2026
Related to
naokihaba commentedon Aug 16, 2026
@birkskyum Thank you for the clarification. I understand that this issue may be addressed by nitrojs/nitro#4509. I’ll close this issue for now and keep an eye on that PR. If the problem persists after the fix is released, I’ll reopen this issue.