Skip to content

Commit

Permalink
feat(ssr): include importer in module resolution error
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Jun 27, 2021
1 parent 65b535c commit 012dc97
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/vite/src/node/ssr/ssrModuleLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ function resolveId(
) {
const resolved = tryNodeResolve(id, importer, resolveOptions, false)
if (!resolved) {
throw Error(`Cannot find module '${id}'`)
throw Error(
`Cannot find module '${id}'` +
(importer ? ` imported by '${importer}'` : ``)
)
}
return resolved.id
}

0 comments on commit 012dc97

Please sign in to comment.