diff --git a/packages/vite/src/node/server/middlewares/indexHtml.ts b/packages/vite/src/node/server/middlewares/indexHtml.ts index 55f5d611f3264b..9de3d1f7c7b548 100644 --- a/packages/vite/src/node/server/middlewares/indexHtml.ts +++ b/packages/vite/src/node/server/middlewares/indexHtml.ts @@ -351,7 +351,6 @@ function preTransformRequest(server: ViteDevServer, url: string, base: string) { // transform all url as non-ssr as html includes client-side assets only server.transformRequest(url).catch((e) => { - // Unexpected error, log the issue but avoid an unhandled exception if ( e?.code === ERR_OUTDATED_OPTIMIZED_DEP || e?.code === ERR_CLOSED_SERVER @@ -359,6 +358,7 @@ function preTransformRequest(server: ViteDevServer, url: string, base: string) { // these are expected errors return } + // Unexpected error, log the issue but avoid an unhandled exception server.config.logger.error(e.message) }) }