Skip to content

Commit 24eaaab

Browse files
authored
fix: use IMAGE_FUNCTION_NAME constant (#2001)
1 parent ab686f9 commit 24eaaab

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/runtime/src/helpers/config.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { NextConfigComplete } from 'next/dist/server/config-shared'
66
import { join, dirname, relative } from 'pathe'
77
import slash from 'slash'
88

9-
import { HANDLER_FUNCTION_NAME, ODB_FUNCTION_NAME } from '../constants'
9+
import { HANDLER_FUNCTION_NAME, IMAGE_FUNCTION_NAME, ODB_FUNCTION_NAME } from '../constants'
1010

1111
import type { RoutesManifest } from './types'
1212
import { escapeStringRegexp } from './utils'
@@ -107,18 +107,16 @@ export const configureHandlerFunctions = async ({
107107
const files = config.files || []
108108
const cssFilesToInclude = files.filter((f) => f.startsWith(`${publish}/static/css/`))
109109

110-
/* eslint-disable no-underscore-dangle */
111110
if (!destr(process.env.DISABLE_IPX)) {
112-
netlifyConfig.functions._ipx ||= {}
113-
netlifyConfig.functions._ipx.node_bundler = 'nft'
111+
netlifyConfig.functions[IMAGE_FUNCTION_NAME] ||= {}
112+
netlifyConfig.functions[IMAGE_FUNCTION_NAME].node_bundler = 'nft'
114113
}
115114

116115
// If the user has manually added the module to included_files, then don't exclude it
117116
const excludedModules = DEFAULT_EXCLUDED_MODULES.filter(
118117
(moduleName) => !hasManuallyAddedModule({ netlifyConfig, moduleName }),
119118
)
120119

121-
/* eslint-enable no-underscore-dangle */
122120
;[HANDLER_FUNCTION_NAME, ODB_FUNCTION_NAME, '_api_*'].forEach((functionName) => {
123121
netlifyConfig.functions[functionName] ||= { included_files: [], external_node_modules: [] }
124122
netlifyConfig.functions[functionName].node_bundler = 'nft'

packages/runtime/src/helpers/edge.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import type { MiddlewareManifest } from 'next/dist/build/webpack/plugins/middlew
1010
import type { RouteHas } from 'next/dist/lib/load-custom-routes'
1111
import { outdent } from 'outdent'
1212

13+
import { IMAGE_FUNCTION_NAME } from '../constants'
14+
1315
import { getRequiredServerFiles, NextConfig } from './config'
1416
import { makeLocaleOptional, stripLookahead, transformCaptureGroups } from './matchers'
1517
import { RoutesManifest } from './types'
@@ -465,7 +467,7 @@ export const writeEdgeFunctions = async ({
465467
await ensureDir(edgeFunctionDir)
466468
await copyEdgeSourceFile({ edgeFunctionDir, file: 'ipx.ts', target: 'index.ts' })
467469
await copyFile(
468-
join('.netlify', 'functions-internal', '_ipx', 'imageconfig.json'),
470+
join('.netlify', 'functions-internal', IMAGE_FUNCTION_NAME, 'imageconfig.json'),
469471
join(edgeFunctionDir, 'imageconfig.json'),
470472
)
471473
manifest.functions.push({

0 commit comments

Comments
 (0)