You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ref(nextjs): Extract isBuild into an exported function (#5444)
In nextjs hooks which run both during build- and runtime (like `getStaticProps`, which mostly is a build-time function, but will run at runtime[1] if revalidation is turned on) it's sometimes helpful to know which you're in, and there's no official way to do that that I've been able to find. In our case, we need to know which phase we're in because by the time pages get loaded in order to be rendered during build, they already have a `Sentry.init()` call baked in, causing the SDK to run. Since certain operations can only happen at runtime, we have logic in `index.server.ts` to detect the current phase.
This pulls that logic into a utility function, so that it can be exported. (Ultimately this is a selfish change, as I'd like to be able to use `isBuild` in my test apps, but I figure it's a harmless addition which might help other developers, too.)
[1] https://nextjs.org/docs/basic-features/data-fetching/get-static-props#when-does-getstaticprops-run
0 commit comments