diff --git a/packages/vite/src/vite-node.ts b/packages/vite/src/vite-node.ts index 109d1349ce..97bee4618e 100644 --- a/packages/vite/src/vite-node.ts +++ b/packages/vite/src/vite-node.ts @@ -113,7 +113,13 @@ function createViteNodeMiddleware (ctx: ViteBuildContext, invalidates: Set { - throw createError({ data: err }) + const errorData = { + code: 'VITE_ERROR', + id: moduleId, + stack: '', + ...err + } + throw createError({ data: errorData }) }) return module }