Skip to content

Commit bb246e6

Browse files
committed
Fix assets without name causing analyze failure
1 parent 9624991 commit bb246e6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/analyzer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ function getViewerData(bundleStats, bundleDir, opts) {
4949

5050
// Picking only `*.js or *.mjs` assets from bundle that has non-empty `chunks` array
5151
bundleStats.assets = _.filter(bundleStats.assets, asset => {
52+
// Filter out non 'asset' type asset if type is provided (Webpack 5 add a type to indicate asset types)
53+
if (asset.type && asset.type !== 'asset') {
54+
return false;
55+
}
56+
5257
// Removing query part from filename (yes, somebody uses it for some reason and Webpack supports it)
5358
// See #22
5459
asset.name = asset.name.replace(FILENAME_QUERY_REGEXP, '');

0 commit comments

Comments
 (0)