We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f165d58 commit 959b783Copy full SHA for 959b783
src/index.js
@@ -71,8 +71,17 @@ class MiniCssExtractPlugin {
71
filename: '[name].css',
72
}, options);
73
if (!this.options.chunkFilename) {
74
- // TODO use webpack conversion style here
75
- this.options.chunkFilename = this.options.filename;
+ const { filename } = this.options;
+ 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
+ }
85
}
86
87
0 commit comments