Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: include line and column in error format #10529

Merged
merged 2 commits into from Oct 20, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/vite/src/node/server/middlewares/error.ts
Expand Up @@ -26,7 +26,11 @@ export function buildErrorMessage(
includeStack = true
): string {
if (err.plugin) args.push(` Plugin: ${colors.magenta(err.plugin)}`)
if (err.id) args.push(` File: ${colors.cyan(err.id)}`)
let loc = ''
if (err.loc) {
loc = `:${err.loc.line}:${err.loc.column}`
}
manucorporat marked this conversation as resolved.
Show resolved Hide resolved
if (err.id) args.push(` File: ${colors.cyan(err.id)}${loc}`)
if (err.frame) args.push(colors.yellow(pad(err.frame)))
if (includeStack && err.stack) args.push(pad(cleanStack(err.stack)))
return args.join('\n')
Expand Down