File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,15 +3,20 @@ import {
33 IS_DEV_ENV ,
44 NEXT_DATA_URL ,
55 VERCEL_ENV ,
6+ VERCEL_REGION ,
67} from '@/next.constants.mjs' ;
78import type { BlogPostsRSC } from '@/types' ;
89
910const getBlogData = ( cat : string , page ?: number ) : Promise < BlogPostsRSC > => {
11+ const IS_NOT_VERCEL_RUNTIME_ENV =
12+ ( ! IS_DEV_ENV && VERCEL_ENV && ! VERCEL_REGION ) ||
13+ ( ! IS_DEV_ENV && ! VERCEL_ENV ) ;
14+
1015 // When we're using Static Exports the Next.js Server is not running (during build-time)
1116 // hence the self-ingestion APIs will not be available. In this case we want to load
1217 // the data directly within the current thread, which will anyways be loaded only once
1318 // We use lazy-imports to prevent `provideBlogData` from executing on import
14- if ( ENABLE_STATIC_EXPORT || ( VERCEL_ENV !== 'production' && ! IS_DEV_ENV ) ) {
19+ if ( ENABLE_STATIC_EXPORT || IS_NOT_VERCEL_RUNTIME_ENV ) {
1520 return import ( '@/next-data/providers/blogData' ) . then (
1621 ( { provideBlogPosts, providePaginatedBlogPosts } ) =>
1722 page ? providePaginatedBlogPosts ( cat , page ) : provideBlogPosts ( cat )
Original file line number Diff line number Diff line change 33 IS_DEV_ENV ,
44 NEXT_DATA_URL ,
55 VERCEL_ENV ,
6+ VERCEL_REGION ,
67} from '@/next.constants.mjs' ;
78import { availableLocaleCodes } from '@/next.locales.mjs' ;
89import type { DownloadSnippet } from '@/types' ;
@@ -14,11 +15,15 @@ const getDownloadSnippets = (lang: string): Promise<Array<DownloadSnippet>> => {
1415 return Promise . resolve ( [ ] ) ;
1516 }
1617
18+ const IS_NOT_VERCEL_RUNTIME_ENV =
19+ ( ! IS_DEV_ENV && VERCEL_ENV && ! VERCEL_REGION ) ||
20+ ( ! IS_DEV_ENV && ! VERCEL_ENV ) ;
21+
1722 // When we're using Static Exports the Next.js Server is not running (during build-time)
1823 // hence the self-ingestion APIs will not be available. In this case we want to load
1924 // the data directly within the current thread, which will anyways be loaded only once
2025 // We use lazy-imports to prevent `provideBlogData` from executing on import
21- if ( ENABLE_STATIC_EXPORT || ( VERCEL_ENV !== 'production' && ! IS_DEV_ENV ) ) {
26+ if ( ENABLE_STATIC_EXPORT || IS_NOT_VERCEL_RUNTIME_ENV ) {
2227 return import ( '@/next-data/providers/downloadSnippets' ) . then (
2328 ( { default : provideDownloadSnippets } ) => provideDownloadSnippets ( lang ) !
2429 ) ;
Original file line number Diff line number Diff line change @@ -3,15 +3,20 @@ import {
33 IS_DEV_ENV ,
44 NEXT_DATA_URL ,
55 VERCEL_ENV ,
6+ VERCEL_REGION ,
67} from '@/next.constants.mjs' ;
78import type { NodeRelease } from '@/types' ;
89
910const getReleaseData = ( ) : Promise < Array < NodeRelease > > => {
11+ const IS_NOT_VERCEL_RUNTIME_ENV =
12+ ( ! IS_DEV_ENV && VERCEL_ENV && ! VERCEL_REGION ) ||
13+ ( ! IS_DEV_ENV && ! VERCEL_ENV ) ;
14+
1015 // When we're using Static Exports the Next.js Server is not running (during build-time)
1116 // hence the self-ingestion APIs will not be available. In this case we want to load
1217 // the data directly within the current thread, which will anyways be loaded only once
1318 // We use lazy-imports to prevent `provideBlogData` from executing on import
14- if ( ENABLE_STATIC_EXPORT || ( VERCEL_ENV !== 'production' && ! IS_DEV_ENV ) ) {
19+ if ( ENABLE_STATIC_EXPORT || IS_NOT_VERCEL_RUNTIME_ENV ) {
1520 return import ( '@/next-data/providers/releaseData' ) . then (
1621 ( { default : provideReleaseData } ) => provideReleaseData ( )
1722 ) ;
Original file line number Diff line number Diff line change 33/// <reference types="next/navigation-types/compat/navigation" />
44
55// NOTE: This file should not be edited
6- // see https://nextjs.org/docs/app/api-reference/config /typescript for more information.
6+ // see https://nextjs.org/docs/app/building-your-application/configuring /typescript for more information.
You can’t perform that action at this time.
0 commit comments