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

Commit

Permalink
fix(vite): normalize vite-node error data from server (#7589)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Sep 16, 2022
1 parent 2b57bfe commit cfaca9c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/vite/src/vite-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ function createViteNodeMiddleware (ctx: ViteBuildContext, invalidates: Set<strin
throw createError({ statusCode: 400 })
}
const module = await node.fetchModule(moduleId).catch((err) => {
throw createError({ data: err })
const errorData = {
code: 'VITE_ERROR',
id: moduleId,
stack: '',
...err
}
throw createError({ data: errorData })
})
return module
}
Expand Down

0 comments on commit cfaca9c

Please sign in to comment.