@@ -84,8 +84,6 @@ module.exports = class SplitChunksPlugin {
84
84
}
85
85
86
86
static normalizeOptions ( options = { } ) {
87
- const chunkFilenameDelimiter = options . chunkFilenameDelimiter || "~" ;
88
-
89
87
return {
90
88
chunks : options . chunks || "all" ,
91
89
minSize : options . minSize || 0 ,
@@ -94,51 +92,50 @@ module.exports = class SplitChunksPlugin {
94
92
maxInitialRequests : options . maxInitialRequests || 1 ,
95
93
getName :
96
94
SplitChunksPlugin . normalizeName ( {
97
- option : options . name ,
98
- chunkFilenameDelimiter
95
+ name : options . name ,
96
+ automaticNameDelimiter : options . automaticNameDelimiter
99
97
} ) || ( ( ) => { } ) ,
100
98
filename : options . filename || undefined ,
101
99
getCacheGroups : SplitChunksPlugin . normalizeCacheGroups ( {
102
100
cacheGroups : options . cacheGroups ,
103
- chunkFilenameDelimiter
104
- } ) ,
105
- chunkFilenameDelimiter : chunkFilenameDelimiter
101
+ automaticNameDelimiter : options . automaticNameDelimiter
102
+ } )
106
103
} ;
107
104
}
108
105
109
- static normalizeName ( { option , chunkFilenameDelimiter } ) {
110
- if ( option === true ) {
106
+ static normalizeName ( { name , automaticNameDelimiter } ) {
107
+ if ( name === true ) {
111
108
const fn = ( module , chunks , cacheGroup ) => {
112
109
const names = chunks . map ( c => c . name ) ;
113
110
if ( ! names . every ( Boolean ) ) return ;
114
111
names . sort ( ) ;
115
112
let name =
116
113
( cacheGroup && cacheGroup !== "default"
117
- ? cacheGroup + chunkFilenameDelimiter
118
- : "" ) + names . join ( chunkFilenameDelimiter ) ;
114
+ ? cacheGroup + automaticNameDelimiter
115
+ : "" ) + names . join ( automaticNameDelimiter ) ;
119
116
// Filenames and paths can't be too long otherwise an
120
117
// ENAMETOOLONG error is raised. If the generated name if too
121
118
// long, it is truncated and a hash is appended. The limit has
122
119
// been set to 100 to prevent `[name].[chunkhash].[ext]` from
123
120
// generating a 256+ character string.
124
121
if ( name . length > 100 ) {
125
122
name =
126
- name . slice ( 0 , 100 ) + chunkFilenameDelimiter + hashFilename ( name ) ;
123
+ name . slice ( 0 , 100 ) + automaticNameDelimiter + hashFilename ( name ) ;
127
124
}
128
125
return name ;
129
126
} ;
130
127
return fn ;
131
128
}
132
129
if ( typeof option === "string" ) {
133
130
const fn = ( ) => {
134
- return option ;
131
+ return name ;
135
132
} ;
136
133
return fn ;
137
134
}
138
- if ( typeof option === "function" ) return option ;
135
+ if ( typeof option === "function" ) return name ;
139
136
}
140
137
141
- static normalizeCacheGroups ( { cacheGroups, chunkFilenameDelimiter } ) {
138
+ static normalizeCacheGroups ( { cacheGroups, automaticNameDelimiter } ) {
142
139
if ( typeof cacheGroups === "function" ) {
143
140
return cacheGroups ;
144
141
}
@@ -174,8 +171,8 @@ module.exports = class SplitChunksPlugin {
174
171
key : key ,
175
172
priority : option . priority ,
176
173
getName : SplitChunksPlugin . normalizeName ( {
177
- option : option . name ,
178
- chunkFilenameDelimiter
174
+ name : option . name ,
175
+ automaticNameDelimiter
179
176
} ) ,
180
177
chunks : option . chunks ,
181
178
enforce : option . enforce ,
0 commit comments