Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/build/vite/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ export async function configureViteDevServer(ctx: NitroPluginContext, server: Vi
if (nodeRes.writableEnded || nodeRes.headersSent) {
return;
}
if (envRes.status === 404) {
// Allow Vite to try
nodeReq._nitroHandled = false;
return next();
}
return await sendNodeResponse(nodeRes, envRes);
} catch (error) {
return next(error);
Expand All @@ -236,8 +241,6 @@ export async function configureViteDevServer(ctx: NitroPluginContext, server: Vi
if (
// Originating from browser tab or no fetch dest (curl, fetch, etc) and (not script, style, image, etc)
(!fetchDest || /^(document|iframe|frame|empty)$/.test(fetchDest)) &&
// No file extension (not /src/index.ts)
!req.url!.match(/\.([a-z0-9]+)(?:[?#]|$)/i)?.[1] &&
// Special prefixes (/__vue-router/auto-routes, /@vite-plugin-layouts/, etc)
!/^\/(?:__|@)/.test(req.url!)
) {
Expand Down
Loading