@@ -84,39 +84,46 @@ module.exports = class SplitChunksPlugin {
8484 }
8585
8686 static normalizeOptions ( options = { } ) {
87- const chunkFilenameDelimiter = options . chunkFilenameDelimiter || '~' ;
87+ const chunkFilenameDelimiter = options . chunkFilenameDelimiter || "~" ;
8888
8989 return {
9090 chunks : options . chunks || "all" ,
9191 minSize : options . minSize || 0 ,
9292 minChunks : options . minChunks || 1 ,
9393 maxAsyncRequests : options . maxAsyncRequests || 1 ,
9494 maxInitialRequests : options . maxInitialRequests || 1 ,
95- getName : SplitChunksPlugin . normalizeName ( options . name , chunkFilenameDelimiter ) || ( ( ) => { } ) ,
95+ getName :
96+ SplitChunksPlugin . normalizeName ( {
97+ option : options . name ,
98+ chunkFilenameDelimiter
99+ } ) || ( ( ) => { } ) ,
96100 filename : options . filename || undefined ,
97- getCacheGroups : SplitChunksPlugin . normalizeCacheGroups (
98- options . cacheGroups , chunkFilenameDelimiter
99- ) ,
101+ getCacheGroups : SplitChunksPlugin . normalizeCacheGroups ( {
102+ cacheGroups : options . cacheGroups ,
103+ chunkFilenameDelimiter
104+ } ) ,
100105 chunkFilenameDelimiter : chunkFilenameDelimiter
101106 } ;
102107 }
103108
104- static normalizeName ( option , chunkFilenameDelimiter ) {
109+ static normalizeName ( { option, chunkFilenameDelimiter } ) {
105110 if ( option === true ) {
106111 const fn = ( module , chunks , cacheGroup ) => {
107112 const names = chunks . map ( c => c . name ) ;
108113 if ( ! names . every ( Boolean ) ) return ;
109114 names . sort ( ) ;
110115 let name =
111- ( cacheGroup && cacheGroup !== "default" ? cacheGroup + chunkFilenameDelimiter : "" ) +
112- names . join ( chunkFilenameDelimiter ) ;
116+ ( cacheGroup && cacheGroup !== "default"
117+ ? cacheGroup + chunkFilenameDelimiter
118+ : "" ) + names . join ( chunkFilenameDelimiter ) ;
113119 // Filenames and paths can't be too long otherwise an
114120 // ENAMETOOLONG error is raised. If the generated name if too
115121 // long, it is truncated and a hash is appended. The limit has
116122 // been set to 100 to prevent `[name].[chunkhash].[ext]` from
117123 // generating a 256+ character string.
118124 if ( name . length > 100 ) {
119- name = name . slice ( 0 , 100 ) + chunkFilenameDelimiter + hashFilename ( name ) ;
125+ name =
126+ name . slice ( 0 , 100 ) + chunkFilenameDelimiter + hashFilename ( name ) ;
120127 }
121128 return name ;
122129 } ;
@@ -131,7 +138,7 @@ module.exports = class SplitChunksPlugin {
131138 if ( typeof option === "function" ) return option ;
132139 }
133140
134- static normalizeCacheGroups ( cacheGroups , chunkFilenameDelimiter ) {
141+ static normalizeCacheGroups ( { cacheGroups, chunkFilenameDelimiter } ) {
135142 if ( typeof cacheGroups === "function" ) {
136143 return cacheGroups ;
137144 }
@@ -166,7 +173,10 @@ module.exports = class SplitChunksPlugin {
166173 results . push ( {
167174 key : key ,
168175 priority : option . priority ,
169- getName : SplitChunksPlugin . normalizeName ( option . name , chunkFilenameDelimiter ) ,
176+ getName : SplitChunksPlugin . normalizeName ( {
177+ option : option . name ,
178+ chunkFilenameDelimiter
179+ } ) ,
170180 chunks : option . chunks ,
171181 enforce : option . enforce ,
172182 minSize : option . minSize ,
0 commit comments