File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ export default abstract class ManifestParser<
26
26
protected inputManifest : Manifest ;
27
27
protected webAccessibleScriptsFilter : ReturnType < typeof createFilter > ;
28
28
protected viteDevServer : ViteDevServer | undefined ;
29
+ protected parsedMetaDataChunkIds = new Set < string > ( ) ;
29
30
30
31
constructor (
31
32
protected pluginOptions : ViteWebExtensionOptions ,
@@ -260,14 +261,24 @@ export default abstract class ManifestParser<
260
261
metadata : {
261
262
css : Set < string > ;
262
263
assets : Set < string > ;
263
- } = {
264
- css : new Set < string > ( ) ,
265
- assets : new Set < string > ( ) ,
266
- }
264
+ } | null = null
267
265
) : {
268
266
css : Set < string > ;
269
267
assets : Set < string > ;
270
268
} {
269
+ if ( metadata === null ) {
270
+ this . parsedMetaDataChunkIds . clear ( ) ;
271
+
272
+ metadata = {
273
+ css : new Set < string > ( ) ,
274
+ assets : new Set < string > ( ) ,
275
+ } ;
276
+ }
277
+
278
+ if ( this . parsedMetaDataChunkIds . has ( chunkId ) ) {
279
+ return metadata ;
280
+ }
281
+
271
282
const chunkInfo = getChunkInfoFromBundle ( bundle , chunkId ) ;
272
283
if ( ! chunkInfo ) {
273
284
return metadata ;
@@ -283,6 +294,8 @@ export default abstract class ManifestParser<
283
294
metadata . assets
284
295
) ;
285
296
297
+ this . parsedMetaDataChunkIds . add ( chunkId ) ;
298
+
286
299
chunkInfo . imports . forEach (
287
300
( chunkId ) =>
288
301
( metadata = this . getMetadataforChunk ( chunkId , bundle , true , metadata ) )
You can’t perform that action at this time.
0 commit comments