reactjs - Next.js - I need static error page template in non-static app router based app - Stack Overflow

admin2025-04-30  0

I have a React app using Next.js with the app router. The app is not a static site.

I'm also using Python for the backend, so I need a single static HTML file which could be used as a template for the backend (non-Next) errors. I need to be able to insert arbitrary error messages into it by editing the HTML. However I also need it to use the normal layout the rest of the site uses, and this includes running the React code, especially the styled components styles.

I've tried just copying the _not-found.html file, and replacing the message text here, however if I allow the JS to run, the text is replaced back with the original not found text.

How can I do that?

转载请注明原文地址:http://anycun.com/QandA/1746023131a91479.html