Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions packages/zip-it-and-ship-it/src/feature_flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ export const defaultFlags = {

// Adds the `___netlify-telemetry.mjs` file to the function bundle.
zisi_add_instrumentation_loader: true,

// Dynamically import the function handler.
zisi_dynamic_import_function_handler_entry_point: false,
} as const

export type FeatureFlags = Partial<Record<keyof typeof defaultFlags, boolean>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,15 @@ export const kebabCase = (input: string): string =>
const getEntryFileContents = (
mainPath: string,
moduleFormat: string,
featureFlags: FeatureFlags,
_featureFlags: FeatureFlags,
runtimeAPIVersion: number,
) => {
const importPath = `.${mainPath.startsWith('/') ? mainPath : `/${mainPath}`}`

if (runtimeAPIVersion === 2) {
if (featureFlags.zisi_dynamic_import_function_handler_entry_point) {
return [
`import * as bootstrap from './${BOOTSTRAP_FILE_NAME}'`,
`export const handler = bootstrap.getLambdaHandler('${importPath}')`,
].join(';')
}
return [
`import * as bootstrap from './${BOOTSTRAP_FILE_NAME}'`,
`import * as func from '${importPath}'`,

// See https://esbuild.github.io/content-types/#default-interop.
'const funcModule = typeof func.default === "function" ? func : func.default',

`export const handler = bootstrap.getLambdaHandler(funcModule)`,
`export const handler = bootstrap.getLambdaHandler('${importPath}')`,
].join(';')
}

Expand Down
Loading