Skip to content
Discussion options

You must be logged in to vote

Ok, so yeah:

Important

These patches apply to development mode only

In Pages Router

  • let origConsoleError = console.error
    function nextJsHandleConsoleError(...args: any[]) {
    // See https://github.com/facebook/react/blob/d50323eb845c5fde0d720cae888bf35dedd05506/packages/react-reconciler/src/ReactFiberErrorLogger.js#L78
    const error = process.env.NODE_ENV !== 'production' ? args[1] : args[0]
    storeHydrationErrorStateFromConsoleArgs(...args)
    handleError(error)
    origConsoleError.apply(window.console, args)
    }

The nextJsHandleConsoleError is…

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@icyJoseph
Comment options

@icyJoseph
Comment options

@lukasb
Comment options

@icyJoseph
Comment options

Answer selected by lukasb
@icyJoseph
Comment options

@icyJoseph
Comment options

@samcx
Comment options

samcx Feb 7, 2025
Collaborator

@samcx
Comment options

samcx Feb 7, 2025
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants