File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,18 +10,20 @@ class WarnCaseSensitiveModulesPlugin {
1010 apply ( compiler ) {
1111 compiler . plugin ( "compilation" , compilation => {
1212 compilation . plugin ( "seal" , function ( ) {
13- const moduleWithoutCase = { } ;
13+ const moduleWithoutCase = new Map ( ) ;
1414 this . modules . forEach ( module => {
15- const ident = module . identifier ( ) . toLowerCase ( ) ;
16- if ( moduleWithoutCase [ `$${ ident } ` ] ) {
17- moduleWithoutCase [ `$${ ident } ` ] . push ( module ) ;
15+ const identifier = module . identifier ( ) . toLowerCase ( ) ;
16+ const moduleInstance = moduleWithoutCase . get ( `$${ identifier } ` )
17+ if ( moduleInstance ) {
18+ moduleWithoutCase . set ( `$${ identifier } ` , moduleInstance . push ( module ) ) ;
1819 } else {
19- moduleWithoutCase [ `$${ ident } ` ] = [ module ] ;
20+ moduleWithoutCase . set ( `$${ identifier } ` , [ module ] ) ;
2021 }
21- } , this ) ;
22+ } ) ;
2223 Object . keys ( moduleWithoutCase ) . forEach ( key => {
23- if ( moduleWithoutCase [ key ] . length > 1 )
24- this . warnings . push ( new CaseSensitiveModulesWarning ( moduleWithoutCase [ key ] ) ) ;
24+ const moduleInstance = moduleWithoutCase . get ( key ) ;
25+ if ( moduleInstance . length > 1 )
26+ this . warnings . push ( new CaseSensitiveModulesWarning ( moduleInstance ) ) ;
2527 } , this ) ;
2628 } ) ;
2729 } ) ;
You can’t perform that action at this time.
0 commit comments