mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 22:59:10 +00:00
fix: formatError() outside rollup context (#11156)
This commit is contained in:
parent
401647feb4
commit
2aee2ebb5d
@ -445,6 +445,21 @@ export async function createPluginContainer(
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (err.loc) {
|
||||
if (!err.frame) {
|
||||
let code = err.pluginCode
|
||||
if (err.loc.file) {
|
||||
err.id = normalizePath(err.loc.file)
|
||||
if (!code) {
|
||||
try {
|
||||
code = fs.readFileSync(err.loc.file, 'utf-8')
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
if (code) {
|
||||
err.frame = generateCodeFrame(code, err.loc)
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user