Allow disabling pre-rendering, even in absence of getServerSideProps
See original GitHub issueFeature request
Add a configuration option to globally disable pre-rendering.
Is your feature request related to a problem? Please describe.
Pre-rendering takes memory, build cycles, and requires that in our that we handle cases where getInitialProps
is not called by next.js. We are fully dependent on getInitialProps
to be called on our pages during SSR, and thus must detect and noop when next is pre-rendering on load or on build. It adds complexity and cost to our dev/build cycles for a feature we do not use.
We use SSR, but strictly via getInitialProps
. This is to avoid the high cost penalty of hitting the server on every client-side navigation. By using getInitialProps, we offload all work to our user’s browsers & CDNs post-browser-application-hydration, and not burden our otherwise busy servers. We understand why getServerSideProps
is a great API, but have opted not to use it for our performance-concerned architecture.
https://nextjs.org/docs/basic-features/pages#pre-rendering implicitly states that “you can use SSR” as an alt method to pre-rendering. However, I am using SSR, just not via the getServerSideProps
API.
Describe the solution you’d like
- an option to disable pre-rendering, likely in the root of next.config.js
- documented option, likely here: https://nextjs.org/docs/basic-features/pages#pre-rendering ?
Describe alternatives you’ve considered
- using getServerSideProps, but deemed it to not be an option
Additional context
n/a
Thanks for your time and consideration.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
It doesn’t seem to work, as shown in this small example: https://repl.it/@caub/nextjs-server-side#pages/index.js
If there was to pre-rendering, there wouldn’t be the console warning: “Warning: Did not expect server HTML to contain the text node “Hello” in <div>”
Also it should render “Test: Hello”
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.