From 326d62803b649926328e7c00942d9eb8e3c6060c Mon Sep 17 00:00:00 2001 From: pooya parsa Date: Wed, 14 Sep 2022 17:58:28 +0200 Subject: [PATCH] fix(vite): show formatted vite-node errors (#7509) --- packages/vite/src/runtime/vite-node.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/runtime/vite-node.mjs b/packages/vite/src/runtime/vite-node.mjs index 8bc19332cc0..dab7b3d5a1b 100644 --- a/packages/vite/src/runtime/vite-node.mjs +++ b/packages/vite/src/runtime/vite-node.mjs @@ -46,9 +46,10 @@ function createRunner () { if (!errorData) { throw err } + let _err try { const { message, stack } = formatViteError(errorData) - throw createError({ + _err = createError({ statusMessage: 'Vite Error', message, stack @@ -62,6 +63,7 @@ function createRunner () { stack: 'Vite Error\nat [check console]' }) } + throw _err }) } })