next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Include sourceframe in errors logged in the terminal during development

Open eps1lon opened this issue 3 months ago • 2 comments

This matches how we special case certain errors already. Since we only do this in dev, we only include the codeframe in dev. This will allow us to replace the special casing in dev and just use console.error.

Example (ignore the wrong method name. Investigating that separately since it's related to the stack not codeframe):

Error: test
    at indirection (webpack:///app/some-module.ts:2:15)
    at indirection (webpack:///app/some-module.ts:6:2)
    at logError (webpack:///app/page.tsx:5:10)
  1 | function indirection() {
> 2 |   console.warn(new Error('test'))
    |               ^
  3 | }
  4 |
  5 | export function logError() {

eps1lon avatar Oct 24 '24 13:10 eps1lon