We have been trying to set up ISR (incremental static regeneration) support in our Next.js applications. In short, Next.js builds static files based on dynamic data on build. By setting up ISR, Next.js will periodically update statically built files during runtime based on a revalidation time. For example: setting revalidation time to 30 seconds will revalidate, rebuild a page and store the page on disk after every 30 seconds.
The initially built pages (during build hook) and dynamically built pages are both stored under the .next folder, which is the default build folder that Next.js uses.
We are having trouble setting this up nicely. The ideal situation would be for the .next build folder to be writeable during the build hook and after, but setting up a mount for this is not supported, because mounts aren’t available during build hooks.
We have worked around this by building to a different location during the build hook and moving the build to the .next folder (which we mounted) in the deploy hook. Though, this solution is subpar.
Any ideas that might make our setup less cluttered or is this the only solution?