Unverified Commit 9e65c6a9 authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Strongly type PageLoader (#16132)

Fixes #16131
parent e72ac764
......@@ -1064,6 +1064,8 @@ export default async function build(
await telemetry.flush()
}
export type ClientSsgManifest = Set<string>
function generateClientSsgManifest(
prerenderManifest: PrerenderManifest,
{
......@@ -1072,7 +1074,7 @@ function generateClientSsgManifest(
isModern,
}: { buildId: string; distDir: string; isModern: boolean }
) {
const ssgPages: Set<string> = new Set<string>([
const ssgPages: ClientSsgManifest = new Set<string>([
...Object.entries(prerenderManifest.routes)
// Filter out dynamic routes
.filter(([, { srcRoute }]) => srcRoute == null)
......
......@@ -15,13 +15,15 @@ import { ampFirstEntryNamesMap } from './next-drop-client-page-plugin'
const isWebpack5 = parseInt(webpack.version!) === 5
export type ClientBuildManifest = Record<string, string[]>
// This function takes the asset map generated in BuildManifestPlugin and creates a
// reduced version to send to the client.
function generateClientManifest(
assetMap: BuildManifest,
isModern: boolean
): string {
const clientManifest: { [s: string]: string[] } = {}
const clientManifest: ClientBuildManifest = {}
const appDependencies = new Set(assetMap.pages['/_app'])
Object.entries(assetMap.pages).forEach(([page, dependencies]) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment