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 3195377 commit 8f54d78
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 @@ -423,6 +423,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 @@ -1515,7 +1530,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 @@ -1718,7 +1737,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 @@ -2061,20 +2081,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 8f54d78

Please sign in to comment.