File tree 1 file changed +4
-3
lines changed
packages/vite/src/node/plugins
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 {
15
15
async renderChunk ( _code , chunk ) {
16
16
// Since the chunk come from rust side, mutate it directly will not sync back to rust side.
17
17
// The next usage will lost the metadata
18
- chunkMetadataMap . set ( chunk . name , {
18
+ chunkMetadataMap . set ( chunk . fileName , {
19
19
importedAssets : new Set ( ) ,
20
20
importedCss : new Set ( ) ,
21
21
} )
@@ -28,6 +28,7 @@ export function metadataPlugin(): Plugin {
28
28
export function getChunkMetadata (
29
29
chunk : RenderedChunk | OutputChunk ,
30
30
) : 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 )
33
34
}
You can’t perform that action at this time.
0 commit comments