Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

Commit cfaca9c

Browse files
authored
fix(vite): normalize vite-node error data from server (#7589)
1 parent 2b57bfe commit cfaca9c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/vite/src/vite-node.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,13 @@ function createViteNodeMiddleware (ctx: ViteBuildContext, invalidates: Set<strin
113113
throw createError({ statusCode: 400 })
114114
}
115115
const module = await node.fetchModule(moduleId).catch((err) => {
116-
throw createError({ data: err })
116+
const errorData = {
117+
code: 'VITE_ERROR',
118+
id: moduleId,
119+
stack: '',
120+
...err
121+
}
122+
throw createError({ data: errorData })
117123
})
118124
return module
119125
}

0 commit comments

Comments
 (0)