mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
20 lines
447 B
TypeScript
20 lines
447 B
TypeScript
|
import {normalizePagePath} from './require'
|
||
|
|
||
|
type BuildManifest = {
|
||
|
pages: {
|
||
|
[page: string]: string[]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export function getPageFiles (buildManifest: BuildManifest, page: string): string[] {
|
||
|
const normalizedPage = normalizePagePath(page)
|
||
|
const files = buildManifest.pages[normalizedPage]
|
||
|
|
||
|
if (!files) {
|
||
|
console.warn(`Could not find files for ${normalizedPage} in .next/build-manifest.json`)
|
||
|
return []
|
||
|
}
|
||
|
|
||
|
return files
|
||
|
}
|