webpack/webpack-bundle-analyzer

Document webpack-dev-server interplay only displaying stat sizes

Closed this issue · 6 comments

The closed issue #147 has some valuable comments about webpack-bundle-analyzer only showing stat sizes when bundle output does not go to the filesystem.

It would be valuable to document this caveat in the README.md.

This contribution opportunity has been seized by @fanich37

Please avoid creating competing pull requests


Here's some background from the linked issue:

@jeron-diovis in #147 (comment)

Just ran into this issue using analyzer with webpack-dev-server. No angular or things like this.

The problem is that analyzer uses physical files to calc parsed/gzipped sizes – while webpack-dev-server keeps everything in memory.

Second problem is that being used as plugin, analyzer shows no errors, while CLI tools says Couldn't parse bundle asset.

As I understand, there is nothing analyzer can do with webpack-dev-server, but maybe it's worth to explicitly mention in docs that you should have files on disc to get parsed/gzipped info?

@Macil in #147 (comment)

I was using webpack with gulp and compiler.outputFileSystem = new MemoryFS(); so that webpack wouldn't write the bundles itself, so I ran into the same issue as @jeron-diovis. The BundleAnalyzerPlugin didn't report any errors at all in the console, just silently produced stat-sized-only reports. I had to use webpack-bundle-analyzer on the command line on the profile json in order to see any kind of error message, which I only thought to do because of this thread.

Hi, @valscion . May I take this one?

Sure! 👍

This should perhaps be updated in the docs to the current error string, which (for me) is:

Error parsing bundle asset "your_bundle_name.bundle.js": no such file
No bundles were parsed. Analyzer will show only original module sizes from stats file.

Rather than the outdated:

Couldn't parse bundle asset "your_bundle_name.bundle.js".
Analyzer will use module sizes from stats file.

If I'm not mistaken.

Hmm yeah, makes sense. Feel free to open a PR to change the docs.

I wonder when the outdated text was changed, or whether it comes from some other place in the code that I now don't recall...

I am facing similar issues. I can only see Stat after running bundle analyser.
Screenshot 2021-11-23 at 7 16 44 PM

Just adding following line makes it happen,
'react-dates/lib': 'react-dates/esm'

 resolve: {
      modules: [path.resolve(__dirname), 'node_modules'],
      alias: {
        ....
        'react-dates/lib': 'react-dates/esm'
      },

If I remove this line, I am able to see all three ( Stat, Parse, Gzipped)

Logs


Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/listings.ca000d74c8c3d444f5bb.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/383.c4f37401fce0d5d17251.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/513.3ee8770c259eb4dc40d3.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/fa.6912da9faf08c2443762.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/9532.08fdeb4bb3242bf5dd03.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/476.aa246cd3d41a38e57f5a.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/6350.cc4d2249c16bac0b5c7f.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/289.8b1937750209e918ca5e.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/promotions.c1ddfa1417ee87b1e8e7.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/238.64dc60aa00b757923af9.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/5639.93c6c9816b101f4d2f57.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/397.fa964c3bde40237bcda9.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/953.d0fb03309efcbc95434b.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/fbflite.4b58541d0a3fa775ba92.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/850.5cab811dc87b85c165b9.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/546.ddc0bda42bcd377f330d.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/app.c5465342fad49a75af26.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/9072.e6be74f73f8427a09579.js": no such file
Error parsing bundle asset "/Users/kanishk.agrawal/workspace/sp-seller-dashboard/client/dist/bundles/partnerServices.9e9d449061b978da4aeb.js": no such fil

May I know how can it be fixed?

Please open a new issue and fill the issue template.