@@ -42,8 +42,10 @@ RecordIdsPlugin.prototype.apply = function(compiler) {
4242 } ) ;
4343 } ) ;
4444
45- function getDepBlockIdent ( block ) {
45+ function getDepBlockIdent ( chunk , block ) {
4646 var ident = [ ] ;
47+ if ( block . chunks . length > 1 )
48+ ident . push ( block . chunks . indexOf ( chunk ) ) ;
4749 while ( block . parent ) {
4850 var p = block . parent ;
4951 var idx = p . blocks . indexOf ( block ) ;
@@ -62,7 +64,7 @@ RecordIdsPlugin.prototype.apply = function(compiler) {
6264 if ( ! records . chunks . byBlocks ) records . chunks . byBlocks = { } ;
6365 chunks . forEach ( function ( chunk ) {
6466 var name = chunk . name ;
65- var blockIdents = chunk . blocks . map ( getDepBlockIdent ) . filter ( Boolean ) ;
67+ var blockIdents = chunk . blocks . map ( getDepBlockIdent . bind ( null , chunk ) ) . filter ( Boolean ) ;
6668 if ( name ) records . chunks . byName [ name ] = chunk . id ;
6769 blockIdents . forEach ( function ( blockIdent ) {
6870 records . chunks . byBlocks [ blockIdent ] = chunk . id ;
@@ -91,16 +93,16 @@ RecordIdsPlugin.prototype.apply = function(compiler) {
9193 } ) . map ( function ( chunk ) {
9294 return {
9395 chunk : chunk ,
94- blockIdents : chunk . blocks . map ( getDepBlockIdent ) . filter ( Boolean )
96+ blockIdents : chunk . blocks . map ( getDepBlockIdent . bind ( null , chunk ) ) . filter ( Boolean )
9597 }
9698 } ) . filter ( function ( arg ) {
9799 return arg . blockIdents . length > 0 ;
98100 } ) ;
99101 var blockIdentsCount = { } ;
100102 argumentedChunks . forEach ( function ( arg , idx ) {
101103 arg . blockIdents . forEach ( function ( blockIdent ) {
102- var id = records . chunks . byBlocks [ blockIdent ]
103- if ( ! id ) return ;
104+ var id = records . chunks . byBlocks [ blockIdent ] ;
105+ if ( typeof id !== "number" ) return ;
104106 var accessor = id + ":" + idx ;
105107 blockIdentsCount [ accessor ] = ( blockIdentsCount [ accessor ] || 0 ) + 1 ;
106108 } ) ;
0 commit comments