Unverified Commit 1f6a45d2 authored by Shu Ding's avatar Shu Ding Committed by GitHub

Land reverted fix for chunk file names (#48625)

This PR re-adds #48583, which was accidentally reverted in #48589
(unrelated) somehow.
parent 82a01c11
......@@ -135,7 +135,6 @@ export class ClientReferenceManifestPlugin {
cssFiles: {},
clientModules: {},
}
const dev = this.dev
const clientRequestsSet = new Set()
......@@ -256,13 +255,18 @@ export class ClientReferenceManifestPlugin {
return null
}
return (
requiredChunk.id +
':' +
(requiredChunk.name || requiredChunk.id) +
(dev ? '' : '-' + requiredChunk.hash)
)
// Get the actual chunk file names from the chunk file list.
// It's possible that the chunk is generated via `import()`, in
// that case the chunk file name will be '[name].[contenthash]'
// instead of '[name]-[chunkhash]'.
return [...requiredChunk.files].map((file) => {
// It's possible that a chunk also emits CSS files, that will
// be handled separatedly.
if (!file.endsWith('.js')) return null
return requiredChunk.id + ':' + file
})
})
.flat()
.filter(nonNullable)
}
const requiredChunks = getAppPathRequiredChunks()
......
......@@ -69,8 +69,8 @@ self.__next_require__ =
// eslint-disable-next-line no-undef
;(self as any).__next_chunk_load__ = (chunk: string) => {
if (!chunk) return Promise.resolve()
const [chunkId, chunkFileName] = chunk.split(':')
chunkFilenameMap[chunkId] = `static/chunks/${chunkFileName}.js`
const [chunkId, chunkFilePath] = chunk.split(':')
chunkFilenameMap[chunkId] = chunkFilePath
// @ts-ignore
// eslint-disable-next-line no-undef
......
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