Skip to content

Commit 7f99f89

Browse files
committed
refactor: only evaluate flag once
1 parent 1ea5fb4 commit 7f99f89

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

packages/runtime/src/helpers/config.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import slash from 'slash'
88

99
import { HANDLER_FUNCTION_NAME, IMAGE_FUNCTION_NAME, ODB_FUNCTION_NAME } from '../constants'
1010

11-
import { splitApiRoutes } from './flags'
1211
import type { APILambda } from './functions'
1312
import type { RoutesManifest } from './types'
1413
import { escapeStringRegexp } from './utils'
@@ -102,13 +101,13 @@ export const configureHandlerFunctions = async ({
102101
publish,
103102
ignore = [],
104103
apiLambdas,
105-
featureFlags,
104+
splitApiRoutes,
106105
}: {
107106
netlifyConfig: NetlifyConfig
108107
publish: string
109108
ignore: Array<string>
110109
apiLambdas: APILambda[]
111-
featureFlags: Record<string, unknown>
110+
splitApiRoutes: boolean
112111
}) => {
113112
const config = await getRequiredServerFiles(publish)
114113
const files = config.files || []
@@ -168,7 +167,7 @@ export const configureHandlerFunctions = async ({
168167
configureFunction(HANDLER_FUNCTION_NAME)
169168
configureFunction(ODB_FUNCTION_NAME)
170169

171-
if (splitApiRoutes(featureFlags)) {
170+
if (splitApiRoutes) {
172171
for (const apiLambda of apiLambdas) {
173172
const { functionName, includedFiles } = apiLambda
174173
netlifyConfig.functions[functionName] ||= { included_files: [] }

packages/runtime/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ const plugin: NetlifyPlugin = {
180180
ignore,
181181
publish: relative(process.cwd(), publish),
182182
apiLambdas,
183-
featureFlags,
183+
splitApiRoutes: splitApiRoutes(featureFlags),
184184
})
185185

186186
await movePublicFiles({ appDir, outdir, publish, basePath })

0 commit comments

Comments
 (0)