-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Feature request
Create an environment variable to always remove the req and res object inside ctx.
Is your feature request related to a problem? Please describe.
Next.js is great for building SSR site. But Next.js is great for building static site with export command.
The export command works after build.
The building process could be slow and that is production build which is hard to debug.
When we do export, the req and res are disappeared (Which is true for static web).
When we are development static site, we normally use next dev, and the ctx comes with req and res. If I mistakenly used them, export command would throw error.
Describe the solution you'd like
So what I propose is an environment flag or something inside next.config.js to enforce removal of req and res of ctx object to prevent mistake when building static site. It could be also a "switch" from SSR to Static mode, or vice versa.