You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some developers from webpack/webpack#9802 say what webpack-bundle-analyzer doesn't work with webpack@5, will be great setup CI to ensure all works fine, also acorn should be updated 😄
I don't see a mention in webpack/webpack#9802 to webpack-bundle-analyzer, care to point to any specific comment if someone has said that there's an issue?
This repository only has a development dependency to webpack as it's used only in a few tests. Mostly we rely on stats files generated from various webpack versions instead of running CI with multiple different webpack versions.
Oh, actually, I mean that instead of stats, we use bundles generated by different versions of webpack. In specific cases, there are stats also but the most brittle piece of code relates to generated bundle parsing and module extraction from there.
So basically the easiest way we could have more assurance that webpack @ 5 works would be to create small bundles made with webpack 5 and write out the expected modules JSON next to the bundle output.
I don't have time to do that right now, but if you or someone else is willing to add this kind of small test case for webpack@5, it would be nice ☺️
Thank you @sokra for the extensive information! This looks like something we can work with.
Seems like what we could do would be to pick the modules from the first variable definition in the bundles when the other conditionals have failed.
We already handle both arrays and objects form of modules, so we only need to change the code to find modules from the variable and then do the parsing as before.
If we fail to parse some output bundles, the analyzer will just show the original module size from the stats file. So we should get a graceful degradation instead of a bad crash.
After upgrading to webpack@^5.0.0-beta.22, webpack-bundle-analyzer just shows a single main.js, while other packages such as webpack-visualizer are able to display my files correctly. The content of stats.json looks normal.
Interestingly, after I added back Webpack 4 with yarn add webpack4@npm:webpack@latest, using webpack4 to generate stats.json produces the same issue of a single main.js. If I completely remove Webpack 5, then webpack-bundle-analyzer works again.
Any ideas on how to build using Webpack 5 normally, but use Webpack 4 just for webpack-bundle-analyzer?
Reacted by ylemkimon, Christian Pena Valerio, tosuke, Chang Wang, Thomas Welton, Alexander, Richard Sewell and Dominik Serafin
TypeError: Cannot read property 'name' of undefined
at BundleAnalyzerPlugin.getBundleDirFromCompiler (node_modules/webpack-bundle-analyzer/lib/BundleAnalyzerPlugin.js:142:56)
at BundleAnalyzerPlugin.generateStaticReport (node_modules/webpack-bundle-analyzer/lib/BundleAnalyzerPlugin.js:134:23)
at node_modules/webpack-bundle-analyzer/lib/BundleAnalyzerPlugin.js:64:33
at node_modules/webpack-bundle-analyzer/lib/BundleAnalyzerPlugin.js:73:53
at Array.map (<anonymous>)
at Immediate.<anonymous> (node_modules/webpack-bundle-analyzer/lib/BundleAnalyzerPlugin.js:73:39)
Please help #384 go through by adding tests and discover more information on why that code is necessary. Then we can merge it once we understand why it is needed and if it can have any tests.
I don't have the availability, sorry. I'm already fixing an issue with a project by fixing an issue with a package, that requires a fix to another package, which in turn requires another package fixed 🥲
It's a bit strange; almost no one must be using webpack v5 given the lack of movement on some of these issues. This one for example has been open almost a year, and the webpack v5 stable release was over a month ago.
Activity
valscion commentedon Dec 18, 2019
I wonder what's needed to support webpack 5? What kinds of failures are there when running with webpack 5 currently?
alexander-akait commentedon Dec 18, 2019
Some developers from webpack/webpack#9802 say what webpack-bundle-analyzer doesn't work with webpack@5, will be great setup CI to ensure all works fine, also acorn should be updated 😄
valscion commentedon Dec 18, 2019
Ok thanks for pointin to that issue! That one is a doozy, 281 comments as of now 😅
valscion commentedon Dec 18, 2019
I don't see a mention in webpack/webpack#9802 to
webpack-bundle-analyzer, care to point to any specific comment if someone has said that there's an issue?This repository only has a development dependency to webpack as it's used only in a few tests. Mostly we rely on stats files generated from various webpack versions instead of running CI with multiple different webpack versions.
alexander-akait commentedon Dec 18, 2019
@valscion Can we add webpack@5 stats as test for CI, just want to ensure all works fine
valscion commentedon Dec 18, 2019
Oh, actually, I mean that instead of stats, we use bundles generated by different versions of webpack. In specific cases, there are stats also but the most brittle piece of code relates to generated bundle parsing and module extraction from there.
https://github.com/webpack-contrib/webpack-bundle-analyzer/tree/master/test/bundles contains those tests and are automatically used in tests in pairs:
https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/7cefb5821053f550754b4fef3ca5a57ce49dc957/test/parseUtils.js#L8-L25
valscion commentedon Dec 18, 2019
So basically the easiest way we could have more assurance that webpack @ 5 works would be to create small bundles made with webpack 5 and write out the expected modules JSON next to the bundle output.
I don't have time to do that right now, but if you or someone else is willing to add this kind of small test case for webpack@5, it would be nice☺️
sokra commentedon Dec 18, 2019
webpack has a different output AST so the parser need to be adjusted. It also gets a little bit more challenging as more variations are possible:
Arrow functions may also be normal functions when
output.ecmaVersion: 5.Arrays might be objects too, as with webpack 4.
There might also be one entry module inlined into the runtime code, which is very difficult to identify in production mode.
valscion commentedon Dec 19, 2019
Thank you @sokra for the extensive information! This looks like something we can work with.
Seems like what we could do would be to pick the modules from the first variable definition in the bundles when the other conditionals have failed.
We already handle both arrays and objects form of modules, so we only need to change the code to find modules from the variable and then do the parsing as before.
If we fail to parse some output bundles, the analyzer will just show the original module size from the stats file. So we should get a graceful degradation instead of a bad crash.
a-x- commentedon Jan 25, 2020
Seems, analyzer works with webpack 5 beta 12 now
Linksku commentedon Jul 28, 2020
After upgrading to
webpack@^5.0.0-beta.22,webpack-bundle-analyzerjust shows a singlemain.js, while other packages such aswebpack-visualizerare able to display my files correctly. The content ofstats.jsonlooks normal.Interestingly, after I added back Webpack 4 with
yarn add webpack4@npm:webpack@latest, usingwebpack4to generatestats.jsonproduces the same issue of a singlemain.js. If I completely remove Webpack 5, thenwebpack-bundle-analyzerworks again.Any ideas on how to build using Webpack 5 normally, but use Webpack 4 just for
webpack-bundle-analyzer?jaydenseric commentedon Nov 18, 2020
I haven't fully debugged it yet, but this seems to cause an error with webpack v5:
https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/d09366690257ca69b2b0639cf20f91c0a46f0c0c/src/BundleAnalyzerPlugin.js#L137
valscion commentedon Nov 18, 2020
Looks the same as #384
jaydenseric commentedon Nov 18, 2020
I'm trying to update
size-limitto webpack v5 (to fix ai/size-limit#205), but this is a blocker.size-limituses this plugin for the--whyflag.valscion commentedon Nov 18, 2020
Please help #384 go through by adding tests and discover more information on why that code is necessary. Then we can merge it once we understand why it is needed and if it can have any tests.
jaydenseric commentedon Nov 18, 2020
I don't have the availability, sorry. I'm already fixing an issue with a project by fixing an issue with a package, that requires a fix to another package, which in turn requires another package fixed 🥲
It's a bit strange; almost no one must be using webpack v5 given the lack of movement on some of these issues. This one for example has been open almost a year, and the webpack v5 stable release was over a month ago.
valscion commentedon Nov 18, 2020
Do note that
webpack-bundle-analyzerdoes work with webpack version 5. There is some combination of options which breaks, but not all of webpack 5.We even test that this package works with webpack v5: https://github.com/webpack-contrib/webpack-bundle-analyzer/tree/master/test/webpack-versions/5.4.0
So this is only an edge case that is broken, not the entire support for webpack 5.