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 {
7171 filename : '[name].css' ,
7272 } , options ) ;
7373 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+ }
7685 }
7786 }
7887
You can’t perform that action at this time.
0 commit comments