File tree Expand file tree Collapse file tree 5 files changed +17
-9
lines changed
packages/runtime/src/helpers Expand file tree Collapse file tree 5 files changed +17
-9
lines changed Original file line number Diff line number Diff line change 6
6
push :
7
7
branches : [main]
8
8
9
+ env :
10
+ NEXT_SPLIT_API_ROUTES : true
11
+
9
12
jobs :
10
13
setup :
11
14
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 8
8
schedule :
9
9
- cron : ' 0 0 * * *'
10
10
11
+ env :
12
+ NEXT_SPLIT_API_ROUTES : true
13
+
11
14
jobs :
12
15
setup :
13
16
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ concurrency:
9
9
group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
10
10
cancel-in-progress : true
11
11
12
+ env :
13
+ NEXT_SPLIT_API_ROUTES : true
14
+
12
15
jobs :
13
16
build :
14
17
name : Integration tests
Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ concurrency:
11
11
group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
12
12
cancel-in-progress : true
13
13
14
+ env :
15
+ NEXT_SPLIT_API_ROUTES : true
16
+
14
17
jobs :
15
18
build :
16
19
name : Unit tests
Original file line number Diff line number Diff line change
1
+ import destr from 'destr'
2
+
1
3
/**
2
4
* If this flag is enabled, we generate individual Lambda functions for API Routes.
3
5
* They're packed together in 50mb chunks to avoid hitting the Lambda size limit.
9
11
* If disabled, we bundle all API Routes into a single function.
10
12
* This is can lead to large bundle sizes.
11
13
*
12
- * Enabled by default. Can be disabled by passing NEXT_SPLIT_API_ROUTES=false .
14
+ * Disabled by default. Can be overriden using the NEXT_SPLIT_API_ROUTES env var .
13
15
*/
14
-
15
- export const splitApiRoutes = ( featureFlags : Record < string , unknown > ) : boolean => {
16
- if ( process . env . NEXT_SPLIT_API_ROUTES ) {
17
- return process . env . NEXT_SPLIT_API_ROUTES === 'true'
18
- }
19
- // default to true during testing, swap to false before merging
20
- return typeof featureFlags . next_split_api_routes === 'boolean' ? featureFlags . next_split_api_routes : true
21
- }
16
+ export const splitApiRoutes = ( featureFlags : Record < string , unknown > ) : boolean =>
17
+ destr ( process . env . NEXT_SPLIT_API_ROUTES ) ?? featureFlags . next_split_api_routes ?? false
You can’t perform that action at this time.
0 commit comments