File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -71,8 +71,17 @@ class MiniCssExtractPlugin {
71
71
filename : '[name].css' ,
72
72
} , options ) ;
73
73
if ( ! this . options . chunkFilename ) {
74
- // TODO use webpack conversion style here
75
- this . options . chunkFilename = this . options . filename ;
74
+ const { filename } = this . options ;
75
+ const hasName = filename . includes ( '[name]' ) ;
76
+ const hasId = filename . includes ( '[id]' ) ;
77
+ const hasChunkHash = filename . includes ( '[chunkhash]' ) ;
78
+ // Anything changing depending on chunk is fine
79
+ if ( hasChunkHash || hasName || hasId ) {
80
+ this . options . chunkFilename = filename ;
81
+ } else {
82
+ // Elsewise prefix '[id].' in front of the basename to make it changing
83
+ this . options . chunkFilename = filename . replace ( / ( ^ | \/ ) ( [ ^ / ] * (?: \? | $ ) ) / , '$1[id].$2' ) ;
84
+ }
76
85
}
77
86
}
78
87
You can’t perform that action at this time.
0 commit comments