Skip to content

Commit

Permalink
Always write FunctionsConfigManifest
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed Jan 3, 2024
1 parent 710401a commit 100c932
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,21 @@ async function writeClientSsgManifest(
)
}

interface FunctionsConfigManifest {
version: number
functions: Record<string, Record<string, string | number>>
}

async function writeFunctionsConfigManifest(
distDir: string,
manifest: FunctionsConfigManifest
): Promise<void> {
await writeManifest(
path.join(distDir, SERVER_DIRECTORY, FUNCTIONS_CONFIG_MANIFEST),
manifest
)
}

interface RequiredServerFilesManifest {
version: number
config: NextConfigComplete
Expand Down Expand Up @@ -1521,7 +1536,11 @@ export default async function build(
const analysisBegin = process.hrtime()
const staticCheckSpan = nextBuildSpan.traceChild('static-check')

const functionsConfigManifest = {} as Record<string, Record<string, any>>
const functionsConfigManifest: FunctionsConfigManifest = {
version: 1,
functions: {},
}

const {
customAppGetInitialProps,
namedExports,
Expand Down Expand Up @@ -1724,7 +1743,8 @@ export default async function build(
: undefined

if (staticInfo?.extraConfig) {
functionsConfigManifest[page] = staticInfo.extraConfig
functionsConfigManifest.functions[page] =
staticInfo.extraConfig
}

const pageRuntime = middlewareManifest.functions[
Expand Down Expand Up @@ -2067,20 +2087,7 @@ export default async function build(
)
}

if (Object.keys(functionsConfigManifest).length > 0) {
const manifest: {
version: number
functions: Record<string, Record<string, string | number>>
} = {
version: 1,
functions: functionsConfigManifest,
}

await writeManifest(
path.join(distDir, SERVER_DIRECTORY, FUNCTIONS_CONFIG_MANIFEST),
manifest
)
}
await writeFunctionsConfigManifest(distDir, functionsConfigManifest)

if (!isGenerateMode && config.outputFileTracing && !buildTracesPromise) {
buildTracesPromise = collectBuildTraces({
Expand Down

0 comments on commit 100c932

Please sign in to comment.