webpack-bundle-analyzer: Doesn't parse child workerize'd module
Issue description
I use https://github.com/developit/workerize-loader to bundle some scripts for webworker, but bundle analizer doesn’t parse and display it.
Technical info
- Webpack Bundle Analyzer version: 2.10.0
- Webpack version: 3.5.5.
As you see there is not worker
module in the map:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 28 (17 by maintainers)
Commits related to this issue
- fix: fix worker assets not being included in report Fixes #150 — committed to nolanlawson/webpack-bundle-analyzer by nolanlawson 5 years ago
After debugging a bit, it looks like this a rendering/display issue with analyzer.js, I’ve opened a PR with the fix that generates the view for the worker bundles as well @nolanlawson , can you see if it works for you?
I think I’ve managed to track this issue down. It seems that my worker assets have
asset.chunks.length === 0
. So when it gets to this line of code, it gets filtered out:https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/7cefb5821053f550754b4fef3ca5a57ce49dc957/src/analyzer.js#L39
When I remove the
!_.isEmpty(asset.chunks)
check, then I correctly see my worker assets in the Webpack Bundle Analyzer view. I’m not sure what this empty check was doing, though. Is it safe to remove?@valscion , @th0r : If you could remove the repro needed tag on this bug, that would be great!.. I am not sure if it is possible to create a more minimal repro than the one presented above. Also I think that is the same as #368 , perhaps that can be closed off as a dupe of this one?
I would like to get the PR checked in if there are no issues with it, please let me know how you want to proceed.
I ran into this same issue with my OSS project Pinafore. Unfortunately I couldn’t manage to write a minimal repro; my minimal repro still shows
worker.js
correctly in Webpack Bundle Analyzer.It’s not a minimal repro, but if you’d like to repro the issue, you can do:
Then open up
./.sapper/client/report.html
to see the report.Same issue with
worker-loader
A snippet from my stats file
Ignored because chunks is empty: (
analyzer.js
)https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/master/src/analyzer.js#L34
Will try.