How can I use a single build for different environments but keep the benefits of static generation (or ISR)? #19752
Replies: 3 comments 9 replies
-
@michaelschufi Were you able to figure out a solution for this? |
Beta Was this translation helpful? Give feedback.
-
We had the same problem. As we are using Incremental Static Regeneration dynamic pages were not a problem, we were using blocking strategy and that skipped the build for them. However for non static routes such as the page index.js there is not a native solution, we had to add a node script removing the statically generated html and json files before creating the CI artifact. |
Beta Was this translation helpful? Give feedback.
-
Is there any update on this topic, maybe something has changed with the release of Next.js 14? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We are using a separated build and release pipeline in our CI/CD process. This has the major benefit of having to do only a single build, which then can be deployed to different environments we like. Each of those environments have of course, different environment variables.
However, using Next.js we cannot make use of the performance improvements static generation provides, since we would have to create a build for each environment separately, just because we have to turn off a flag or want a few variables changed.
I was very excited when I first heard about Incremental Static Regeneration. It sounded very nice and I thought we would have a way to statically generate the pages at runtime once, using runtime variables, and they only have to be rerendered by the server if some content changes.
Is there any way to use a single build for different environments, with different runtime variables, and not use
getInitialProps
?Beta Was this translation helpful? Give feedback.
All reactions