How to hide unhandled errors in next js?

201 views Asked by At

I was facing error in next js site so i need to hide it https://i.stack.imgur.com/rkQFD.png

i've added this in "app.js" file and its working so it may also help you if you face this kind of issue

const noOverlayWorkaroundScript = `
  window.addEventListener('error', event => {
    event.stopImmediatePropagation()
  })

  window.addEventListener('unhandledrejection', event => {
    event.stopImmediatePropagation()
  })
`

<script dangerouslySetInnerHTML={{ __html: noOverlayWorkaroundScript }} />

0

There are 0 answers