Skip to content

Commit

Permalink
fix: tolerant fs error in formatError (#3665)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jun 4, 2021
1 parent 80b8043 commit 5146cc5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/vite/src/node/server/pluginContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ export async function createPluginContainer(
let code = ctx._activeCode
if (err.loc.file) {
err.id = normalizePath(err.loc.file)
code = fs.readFileSync(err.loc.file, 'utf-8')
try {
code = fs.readFileSync(err.loc.file, 'utf-8')
} catch {}
}
err.frame = generateCodeFrame(code, err.loc)
}
Expand Down

0 comments on commit 5146cc5

Please sign in to comment.