-
Notifications
You must be signed in to change notification settings - Fork 12k
webpack-bundle-analyzer not working correctly with the latest cli 1.3.0-beta.1 #7057
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
Comments
I can confirm the issue. Haven't been able to track down the problem though |
My guess would be an incompatibility with scope hoisting. If the contents of the bundles is the goal, you can turn on sourcemaps and use sourcemap explorer. |
Just tested with rc.0 and still an issue. |
I understand this happens, but I don't think this is an issue in Angular CLI. We just pass on the stats json option into Have you tried opening an issue in https://github.com/th0r/webpack-bundle-analyzer or https://github.com/webpack/webpack instead? If it's a matter of updating our version of either I'm happy to do so. |
There is an opened issue reporting for CLI 1.2.6, so probably not related to changes on 1.3. |
Yes, this is very likely to be the issue with We're figuring out a solution for this, but for now, drilling deeper into the bundle isn't possible. You could try to view the "stat" size, as it doesn't rely on parsing the generated bundle (where, due to scope hoisting, we've lost the details of module boundaries) |
@ShadowManu I think there's something odd with the setup reported in webpack-contrib/webpack-bundle-analyzer#106, since it does mention CLI 1.2.6 but also Webpack 3.4.1, but CLI 1.2.6 is limited to webpack 2.x. @valscion heya, thanks for chiming in! If there something we can do on Angular CLI to help please let me know. |
Even using sourcemaps, using the latest cli (1.3.0.rc3), all information about the vendor libs is gone |
The sourcemaps bit is a bug with the |
@filipesilva one possibility would be to configure the builds to not use scope hoisting when you want to analyze the bundle contents with I'm not sure if we're able to even figure out the missing information after the scope hoisting, but I haven't yet looked into it that much. |
Hmm, resulting stats file has very strange structure. |
The fact is from As @valscion said, a temporary solution is to provide a flag in |
sorry, simple comment out the plugin doesn't work. There are more things to reconfig. |
Even without prod mode, like |
@e-cloud I use Webpack 3.4 with ModuleConcatenationPlugin in one of my projects and analyzer works fine in my case. |
@th0r, do you use @angular/cli? If not, it sounds may be cli has its own problem too. |
@e-cloud No, I don't. |
Yeah th0r knows |
@e-cloud The problem is in the {
// ...
"chunks": [
// chunks info WITHOUT modules
],
"modules": [
// list of ALL modules from ALL chunks
]
// ...
} But new {
// ...
"chunks": [
// chunks info WITH modules.
// each chunk object has it's own "modules" property with all modules it contains
]
// ...and no top-level "modules" field
} So there is no top-level |
The webpack stats output is highly configurable and its content can vary greatly depending on To that end, is there a reason that the analyzer requires the presence of the top-level modules list? If the chunk modules are present, the analyzer seems to be doing extra work (code ref) filtering the entire modules list to find the modules used per asset. Also, since there is technically no guarantee that either of the module lists are present, it may be prudent to use chunk modules if available (more efficient), then the top-level modules if not, and finally display an error/warning if neither is found. Regardless, I'll put together a PR that will make the Angular CLI use the same stat output options for the file that the current default |
@clydin The thing is it's the first time I see that |
A direct webpack function call is used to obtain the stats object. It supports several presets as well as a fine-grained object-based option argument. Oddly, the default includes both the modules and chunk modules lists; but verbose only includes chunk modules. |
After some additional research, the CLI didn't actually break the functionality. Webpack 3 changed the verbose preset to not include the top level module list. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Versions.
Repro steps.
modify
package.json
by adding a script:"analyze": "ng build --prod --stats-json && webpack-bundle-analyzer dist/stats.json"
npm run analyze
Not showing bundles details/content:

Desired functionality.
Should display bundles details/content
Mention any other details that might be useful.
All working with angular cli 1.0.0 that I was using before
The text was updated successfully, but these errors were encountered: