Fix tracking of client reference manifest (#52505)
The problem was introduced in #52450, that the client reference manifest isn't being tracked and included in the function. Verified that this fixes the issue.
This commit is contained in:
parent
4ddb6fc794
commit
0fe6e850fe
4 changed files with 26 additions and 29 deletions
|
@ -1,7 +1,6 @@
|
|||
import { webpack, sources } from 'next/dist/compiled/webpack/webpack'
|
||||
import {
|
||||
APP_BUILD_MANIFEST,
|
||||
CLIENT_REFERENCE_MANIFEST,
|
||||
CLIENT_STATIC_FILES_RUNTIME_MAIN_APP,
|
||||
SYSTEM_ENTRYPOINTS,
|
||||
} from '../../../shared/lib/constants'
|
||||
|
@ -77,22 +76,7 @@ export class AppBuildManifestPlugin {
|
|||
}
|
||||
|
||||
const filesForPage = getEntrypointFiles(entrypoint)
|
||||
const manifestsForPage =
|
||||
pagePath.endsWith('/page') ||
|
||||
pagePath === '/not-found' ||
|
||||
pagePath === '/_not-found'
|
||||
? [
|
||||
'server/app' +
|
||||
pagePath.replace(/%5F/g, '_') +
|
||||
'_' +
|
||||
CLIENT_REFERENCE_MANIFEST +
|
||||
'.js',
|
||||
]
|
||||
: []
|
||||
|
||||
manifest.pages[pagePath] = [
|
||||
...new Set([...mainFiles, ...manifestsForPage, ...filesForPage]),
|
||||
]
|
||||
manifest.pages[pagePath] = [...new Set([...mainFiles, ...filesForPage])]
|
||||
}
|
||||
|
||||
const json = JSON.stringify(manifest, null, 2)
|
||||
|
|
|
@ -6,7 +6,10 @@ import {
|
|||
nodeFileTrace,
|
||||
NodeFileTraceReasons,
|
||||
} from 'next/dist/compiled/@vercel/nft'
|
||||
import { TRACE_OUTPUT_VERSION } from '../../../shared/lib/constants'
|
||||
import {
|
||||
CLIENT_REFERENCE_MANIFEST,
|
||||
TRACE_OUTPUT_VERSION,
|
||||
} from '../../../shared/lib/constants'
|
||||
import { webpack, sources } from 'next/dist/compiled/webpack/webpack'
|
||||
import {
|
||||
NODE_ESM_RESOLVE_OPTIONS,
|
||||
|
@ -285,6 +288,27 @@ export class TraceEntryPointsPlugin implements webpack.WebpackPluginInstance {
|
|||
// don't include the entry itself in the trace
|
||||
entryFiles.delete(nodePath.join(outputPath, `../${entrypoint.name}.js`))
|
||||
|
||||
if (entrypoint.name.startsWith('app/')) {
|
||||
// include the client reference manifest
|
||||
const clientManifestsForPage =
|
||||
entrypoint.name.endsWith('/page') ||
|
||||
entrypoint.name === '/not-found' ||
|
||||
entrypoint.name === '/_not-found'
|
||||
? nodePath.join(
|
||||
outputPath,
|
||||
'..',
|
||||
entrypoint.name.replace(/%5F/g, '_') +
|
||||
'_' +
|
||||
CLIENT_REFERENCE_MANIFEST +
|
||||
'.js'
|
||||
)
|
||||
: null
|
||||
|
||||
if (clientManifestsForPage !== null) {
|
||||
entryFiles.add(clientManifestsForPage)
|
||||
}
|
||||
}
|
||||
|
||||
const finalFiles: string[] = []
|
||||
|
||||
for (const file of new Set([
|
||||
|
|
|
@ -293,7 +293,6 @@ export default abstract class Server<ServerOptions extends Options = Options> {
|
|||
}): Promise<FindComponentsResult | null>
|
||||
protected abstract getFontManifest(): FontManifest | undefined
|
||||
protected abstract getPrerenderManifest(): PrerenderManifest
|
||||
// protected abstract getServerComponentManifest(): any
|
||||
protected abstract getNextFontManifest(): NextFontManifest | undefined
|
||||
protected abstract attachRequestMeta(
|
||||
req: BaseNextRequest,
|
||||
|
|
|
@ -564,16 +564,6 @@ createNextDescribe(
|
|||
})
|
||||
await Promise.all(promises)
|
||||
})
|
||||
|
||||
it('should generate client reference manifest for edge SSR pages', async () => {
|
||||
const buildManifest = JSON.parse(
|
||||
await next.readFile('.next/app-build-manifest.json')
|
||||
)
|
||||
|
||||
expect(buildManifest.pages['/edge/dynamic/page']).toInclude(
|
||||
'server/app/edge/dynamic/page_client-reference-manifest.js'
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue