File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
packages/vite/src/node/plugins Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export function metadataPlugin(): Plugin {
1515 async renderChunk ( _code , chunk ) {
1616 // Since the chunk come from rust side, mutate it directly will not sync back to rust side.
1717 // The next usage will lost the metadata
18- chunkMetadataMap . set ( chunk . name , {
18+ chunkMetadataMap . set ( chunk . fileName , {
1919 importedAssets : new Set ( ) ,
2020 importedCss : new Set ( ) ,
2121 } )
@@ -28,6 +28,7 @@ export function metadataPlugin(): Plugin {
2828export function getChunkMetadata (
2929 chunk : RenderedChunk | OutputChunk ,
3030) : ChunkMetadata | undefined {
31- // TODO: chunk.name is not unique, use something unique like chunk.preliminaryFileName / chunk.fileName
32- return chunkMetadataMap . get ( chunk . name )
31+ const preliminaryFileName =
32+ 'preliminaryFileName' in chunk ? chunk . preliminaryFileName : chunk . fileName
33+ return chunkMetadataMap . get ( preliminaryFileName )
3334}
You can’t perform that action at this time.
0 commit comments