'How do I debug a nextjs production build?

I have a bug (this one) that only happens in production, on the client side.

Next.js by default silences all error messages in production, and turns off all logging client side. This makes it almost impossible to debug what's going on when an error is in production-mode only.

Is there a flag or some other setting that will allow me to debug code built by next.js for production?



Solution 1:[1]

npm run build && NODE_OPTIONS='--inspect' npm run start 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 hassan khademi