I've encountered this issue so often. It makes 0 sense, especially when the page content exists with JavaScript disabled. Why in the world would you brick the whole page for a JS error?
vlucas · 9h ago
Good rant. I encountered this issue on my own app built with Next.js in production, on STATIC GENERATED blog/article pages. It happened randomly when clicking around through a bunch of pages back and forth. It's such bullshit. Next.js literally blocks static HTML pages with this nonsense "error".
I fixed it by removing all the <Link /> elements, which forces a full page reload vs. going through the client router (imagine using the server and HTTP?!). Ironically, doing this of course defeats a lot of the purpose of Next.js itself for those types of pages. The complexity has become too much. I like React for interactive things, but I will not build any more of my own sites with Next.js. I am now building things with Hyperspan (https://www.hyperspan.dev), which is more of a traditional server framework with interactive client islands.
I fixed it by removing all the <Link /> elements, which forces a full page reload vs. going through the client router (imagine using the server and HTTP?!). Ironically, doing this of course defeats a lot of the purpose of Next.js itself for those types of pages. The complexity has become too much. I like React for interactive things, but I will not build any more of my own sites with Next.js. I am now building things with Hyperspan (https://www.hyperspan.dev), which is more of a traditional server framework with interactive client islands.