@@ -84,8 +84,6 @@ module.exports = class SplitChunksPlugin {
8484 }
8585
8686 static normalizeOptions ( options = { } ) {
87- const chunkFilenameDelimiter = options . chunkFilenameDelimiter || "~" ;
88-
8987 return {
9088 chunks : options . chunks || "all" ,
9189 minSize : options . minSize || 0 ,
@@ -94,51 +92,50 @@ module.exports = class SplitChunksPlugin {
9492 maxInitialRequests : options . maxInitialRequests || 1 ,
9593 getName :
9694 SplitChunksPlugin . normalizeName ( {
97- option : options . name ,
98- chunkFilenameDelimiter
95+ name : options . name ,
96+ automaticNameDelimiter : options . automaticNameDelimiter
9997 } ) || ( ( ) => { } ) ,
10098 filename : options . filename || undefined ,
10199 getCacheGroups : SplitChunksPlugin . normalizeCacheGroups ( {
102100 cacheGroups : options . cacheGroups ,
103- chunkFilenameDelimiter
104- } ) ,
105- chunkFilenameDelimiter : chunkFilenameDelimiter
101+ automaticNameDelimiter : options . automaticNameDelimiter
102+ } )
106103 } ;
107104 }
108105
109- static normalizeName ( { option , chunkFilenameDelimiter } ) {
110- if ( option === true ) {
106+ static normalizeName ( { name , automaticNameDelimiter } ) {
107+ if ( name === true ) {
111108 const fn = ( module , chunks , cacheGroup ) => {
112109 const names = chunks . map ( c => c . name ) ;
113110 if ( ! names . every ( Boolean ) ) return ;
114111 names . sort ( ) ;
115112 let name =
116113 ( cacheGroup && cacheGroup !== "default"
117- ? cacheGroup + chunkFilenameDelimiter
118- : "" ) + names . join ( chunkFilenameDelimiter ) ;
114+ ? cacheGroup + automaticNameDelimiter
115+ : "" ) + names . join ( automaticNameDelimiter ) ;
119116 // Filenames and paths can't be too long otherwise an
120117 // ENAMETOOLONG error is raised. If the generated name if too
121118 // long, it is truncated and a hash is appended. The limit has
122119 // been set to 100 to prevent `[name].[chunkhash].[ext]` from
123120 // generating a 256+ character string.
124121 if ( name . length > 100 ) {
125122 name =
126- name . slice ( 0 , 100 ) + chunkFilenameDelimiter + hashFilename ( name ) ;
123+ name . slice ( 0 , 100 ) + automaticNameDelimiter + hashFilename ( name ) ;
127124 }
128125 return name ;
129126 } ;
130127 return fn ;
131128 }
132129 if ( typeof option === "string" ) {
133130 const fn = ( ) => {
134- return option ;
131+ return name ;
135132 } ;
136133 return fn ;
137134 }
138- if ( typeof option === "function" ) return option ;
135+ if ( typeof option === "function" ) return name ;
139136 }
140137
141- static normalizeCacheGroups ( { cacheGroups, chunkFilenameDelimiter } ) {
138+ static normalizeCacheGroups ( { cacheGroups, automaticNameDelimiter } ) {
142139 if ( typeof cacheGroups === "function" ) {
143140 return cacheGroups ;
144141 }
@@ -174,8 +171,8 @@ module.exports = class SplitChunksPlugin {
174171 key : key ,
175172 priority : option . priority ,
176173 getName : SplitChunksPlugin . normalizeName ( {
177- option : option . name ,
178- chunkFilenameDelimiter
174+ name : option . name ,
175+ automaticNameDelimiter
179176 } ) ,
180177 chunks : option . chunks ,
181178 enforce : option . enforce ,
0 commit comments