Skip to content

Commit

Permalink
fix: throw a clearer error for non-existent sources
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Jul 20, 2021
1 parent 143d5b0 commit f379c96
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/vite/src/node/server/sourcemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ export async function injectSourcesContent(
if (!isVirtual) {
sourcePath = path.resolve(sourceRoot, sourcePath)
}
map.sourcesContent![i] = await fs.readFile(sourcePath, 'utf-8')
try {
map.sourcesContent![i] = await fs.readFile(sourcePath, 'utf-8')
} catch (e) {
throw new Error(
`Sourcemap for "${file}" has a non-existent source: "${sourcePath}"`
)
}
})
)
}

0 comments on commit f379c96

Please sign in to comment.