expatfile / next-runtime-env

Next.js Runtime Environment Configuration - Populates your environment at runtime rather than build time.
https://www.npmjs.com/package/next-runtime-env
MIT License
458 stars 19 forks source link

App Router Support without the need for `unstable_noStore` #142

Open m-sanders opened 5 months ago

m-sanders commented 5 months ago

Use a noStore for env access opts App Router out from the full request cache. This is problematic for static pages that can benefit from edge caching and is a blocker to adopting this library.

There is an experimental next build feature that allows splitting the build step from the generation step:

next build --experimental-build-mode compile/generate. https://github.com/vercel/next.js/discussions/46544

Where the compile step can execute in CI and the generate step can execute in the runtime.

Support for this build approach would allow for this library to support static ahead of time generation with a runtime env and get closer to Vercel Nextjs.

tclxshunquan-wang commented 1 month ago

Are you considering supporting SSG in the future?