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 Jun 25, 2021
1 parent 7105a09 commit d169c1a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/vite/src/node/server/sourcemap.ts
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 d169c1a

Please sign in to comment.