@@ -90,45 +90,52 @@ module.exports = class SplitChunksPlugin {
9090 minChunks : options . minChunks || 1 ,
9191 maxAsyncRequests : options . maxAsyncRequests || 1 ,
9292 maxInitialRequests : options . maxInitialRequests || 1 ,
93- getName : SplitChunksPlugin . normalizeName ( options . name ) || ( ( ) => { } ) ,
93+ getName :
94+ SplitChunksPlugin . normalizeName ( {
95+ name : options . name ,
96+ automaticNameDelimiter : options . automaticNameDelimiter
97+ } ) || ( ( ) => { } ) ,
9498 filename : options . filename || undefined ,
95- getCacheGroups : SplitChunksPlugin . normalizeCacheGroups (
96- options . cacheGroups
97- )
99+ getCacheGroups : SplitChunksPlugin . normalizeCacheGroups ( {
100+ cacheGroups : options . cacheGroups ,
101+ automaticNameDelimiter : options . automaticNameDelimiter
102+ } )
98103 } ;
99104 }
100105
101- static normalizeName ( option ) {
102- if ( option === true ) {
106+ static normalizeName ( { name , automaticNameDelimiter } ) {
107+ if ( name === true ) {
103108 const fn = ( module , chunks , cacheGroup ) => {
104109 const names = chunks . map ( c => c . name ) ;
105110 if ( ! names . every ( Boolean ) ) return ;
106111 names . sort ( ) ;
107112 let name =
108- ( cacheGroup && cacheGroup !== "default" ? cacheGroup + "~" : "" ) +
109- names . join ( "~" ) ;
113+ ( cacheGroup && cacheGroup !== "default"
114+ ? cacheGroup + automaticNameDelimiter
115+ : "" ) + names . join ( automaticNameDelimiter ) ;
110116 // Filenames and paths can't be too long otherwise an
111117 // ENAMETOOLONG error is raised. If the generated name if too
112118 // long, it is truncated and a hash is appended. The limit has
113119 // been set to 100 to prevent `[name].[chunkhash].[ext]` from
114120 // generating a 256+ character string.
115121 if ( name . length > 100 ) {
116- name = name . slice ( 0 , 100 ) + "~" + hashFilename ( name ) ;
122+ name =
123+ name . slice ( 0 , 100 ) + automaticNameDelimiter + hashFilename ( name ) ;
117124 }
118125 return name ;
119126 } ;
120127 return fn ;
121128 }
122- if ( typeof option === "string" ) {
129+ if ( typeof name === "string" ) {
123130 const fn = ( ) => {
124- return option ;
131+ return name ;
125132 } ;
126133 return fn ;
127134 }
128- if ( typeof option === "function" ) return option ;
135+ if ( typeof name === "function" ) return name ;
129136 }
130137
131- static normalizeCacheGroups ( cacheGroups ) {
138+ static normalizeCacheGroups ( { cacheGroups, automaticNameDelimiter } ) {
132139 if ( typeof cacheGroups === "function" ) {
133140 return cacheGroups ;
134141 }
@@ -163,7 +170,10 @@ module.exports = class SplitChunksPlugin {
163170 results . push ( {
164171 key : key ,
165172 priority : option . priority ,
166- getName : SplitChunksPlugin . normalizeName ( option . name ) ,
173+ getName : SplitChunksPlugin . normalizeName ( {
174+ name : option . name ,
175+ automaticNameDelimiter
176+ } ) ,
167177 chunks : option . chunks ,
168178 enforce : option . enforce ,
169179 minSize : option . minSize ,
0 commit comments