-
-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail to analyze webpack 5 stats.json due to hidden assets #385
Comments
Could you create a PR? |
@th0r |
It seems like webpack 5 change the schema of In our case, we config the It seems like webpack 5 generate more information in stats.json. Probably a better fix is to check whether the // Picking only `*.js or *.mjs` assets from bundle that has non-empty `chunks` array
bundleStats.assets = _.filter(bundleStats.assets, asset => {
// Filter out non 'asset' type asset if type is provided (Webpack 5 add a type to indicate asset types)
if (asset.type && asset.type !== 'asset') {
return false;
}
// Removing query part from filename (yes, somebody uses it for some reason and Webpack supports it)
// See #22
asset.name = asset.name.replace(FILENAME_QUERY_REGEXP, '');
return FILENAME_EXTENSIONS.test(asset.name) && !_.isEmpty(asset.chunks) && isAssetIncluded(asset.name);
}); |
Fixed in #386 |
Issue description
We recently switch webpack to version 5 and webpack-bundle-analyzer fail to analyze.
The error below is logged:
Debug info
We dive into code and find out the error is produced by this line of code:
It turns out that webpack version 5 generates a new kind of assets without a name:
We temporary fix this by checking whether
name
is existed or not:The text was updated successfully, but these errors were encountered: