NextJs Preview Functions - How to Access

In my netlify nextjs build, it is creating a preview functions for pages where we use getStatic*.

We do not have the revalidate flag and we are using fallback:‘blocking’ so the ondemand builders are doing their job to create the pages on first access.

Since these preview functions are being created (and using up build time) but are not documented, I want to know what they are for and if I can possible use them to access a live version of the page to look at content changes.

Atleast some documentation you can point me to on these mystery functions would be helpful.

Hey there, @mansoor292 :wave:

Thanks for reaching out. It sounds like you’re referencing the functions that our next-js plugin uses. You can check out the repo here!

We took a look at your build log, and you are right that the functions are taking about 5 minutes of your 7 minute build time. We have a couple of suggestions you can implement:

  1. If you want to reduce functions packaging time, you can move away from server-side rendering. You can rely on statically generating files instead.
  2. Conversely, you could also try using esbuild as the bundler for the functions!
  3. Lastly, For faster deploy times, build IDs should be set to a static value. To do this, set generateBuildId: () => ‘build’ in your next.config.js. This is suggested in your deploy log as well.

Let us know your thoughts!