From 9391c4d063d06ef80b7a82ed63476051955dabe3 Mon Sep 17 00:00:00 2001 From: bluwy Date: Wed, 4 May 2022 02:45:00 +0800 Subject: [PATCH 1/2] fix: handle optimize failure --- packages/vite/src/node/optimizer/registerMissing.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/optimizer/registerMissing.ts b/packages/vite/src/node/optimizer/registerMissing.ts index ee4824389c202b..1a673826b9c740 100644 --- a/packages/vite/src/node/optimizer/registerMissing.ts +++ b/packages/vite/src/node/optimizer/registerMissing.ts @@ -296,7 +296,11 @@ export function createOptimizedDeps(server: ViteDevServer): OptimizedDeps { // Reset missing deps, let the server rediscover the dependencies metadata.discovered = {} - fullReload() + + const isEsbuildError = e.errors && e.warnings + if (!isEsbuildError) { + fullReload() + } } currentlyProcessing = false From beb29a5afacb466467d9fbb9db8fea95eb04573f Mon Sep 17 00:00:00 2001 From: bluwy Date: Wed, 4 May 2022 21:56:43 +0800 Subject: [PATCH 2/2] fix: remove full reload on optimize fail --- packages/vite/src/node/optimizer/registerMissing.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/vite/src/node/optimizer/registerMissing.ts b/packages/vite/src/node/optimizer/registerMissing.ts index 1a673826b9c740..7cf54eb963d7df 100644 --- a/packages/vite/src/node/optimizer/registerMissing.ts +++ b/packages/vite/src/node/optimizer/registerMissing.ts @@ -296,11 +296,6 @@ export function createOptimizedDeps(server: ViteDevServer): OptimizedDeps { // Reset missing deps, let the server rediscover the dependencies metadata.discovered = {} - - const isEsbuildError = e.errors && e.warnings - if (!isEsbuildError) { - fullReload() - } } currentlyProcessing = false