Skip to content

Commit ad341bf

Browse files
committed
resolve chunk canot find when chunk name like this "styles/test.css?db562740a398ac3c4f42e7d579e5b365"
1 parent 9f14df8 commit ad341bf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ function CssChunkHashPlugin(options) {
44
}, options);
55
}
66

7+
const REGX_CSS = /\S*\.css\??[^.]\S*/;
78
CssChunkHashPlugin.prototype.createCssHash = function ({ assetsByChunkName, publicPath }) {
89
return Object.keys(assetsByChunkName).reduce((hash, name) => {
910
if (!assetsByChunkName[name] || !assetsByChunkName[name].find) return hash;
10-
const file = assetsByChunkName[name].find(file => file.endsWith('.css'));
11+
const file = assetsByChunkName[name].find(file => REGX_CSS.test(file));
1112
if (file) hash[name] = `${publicPath}${file}`;
1213
return hash;
1314
}, {});

0 commit comments

Comments
 (0)