Skip to content

Commit d806c4a

Browse files
authoredOct 20, 2022
feat: include line and column in error format (#10529)
1 parent 67e7bf2 commit d806c4a

File tree

1 file changed

+2
-1
lines changed
  • packages/vite/src/node/server/middlewares

1 file changed

+2
-1
lines changed
 

‎packages/vite/src/node/server/middlewares/error.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export function buildErrorMessage(
2626
includeStack = true
2727
): string {
2828
if (err.plugin) args.push(` Plugin: ${colors.magenta(err.plugin)}`)
29-
if (err.id) args.push(` File: ${colors.cyan(err.id)}`)
29+
const loc = err.loc ? `:${err.loc.line}:${err.loc.column}` : ''
30+
if (err.id) args.push(` File: ${colors.cyan(err.id)}${loc}`)
3031
if (err.frame) args.push(colors.yellow(pad(err.frame)))
3132
if (includeStack && err.stack) args.push(pad(cleanStack(err.stack)))
3233
return args.join('\n')

0 commit comments

Comments
 (0)
Please sign in to comment.