Skip to content
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

Cant use webpack bundle analyzer. the stats.json generated by ng build is missing the assets property #27190

Closed
1 task done
windmillcode0 opened this issue Mar 4, 2024 · 5 comments

Comments

@windmillcode0
Copy link

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

17.1.0

Description

From moving from the old architect to the new architect stats.json assets property is missing. webpack-bundle analyzer fails because the assets property is missing and you are not able to view the dependencies in your code

Minimal Reproduction

npm install -s @angular/cli
npx ng new my-app
cd .\my-app
npm install -D webpack-bundle-analyzer
npx ng build --stats-json; npx webpack-bundle-analyzer --port 9000 dist/my-app/stats.json

Exception or Error

Could't analyze webpack bundle:
TypeError: Cannot read properties of undefined (reading 'filter')

Your Environment

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1702.2
@angular-devkit/build-angular   17.2.2
@angular-devkit/core            17.2.2
@angular-devkit/schematics      17.2.2
@angular/cli                    17.2.2
@angular/ssr                    17.2.2
@schematics/angular             17.2.2
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.4

Anything else relevant?

Here is the github repo https://github.com/windmillcode0/angular-webpack-bundle-analyzer-fails
all you have to do is npm install
then npm run analyze

@JoostK
Copy link
Member

JoostK commented Mar 4, 2024

This appears to be webpack-contrib/webpack-bundle-analyzer#490.

@alan-agius4
Copy link
Collaborator

Closing as this is not caused by the Angular CLI.

@alan-agius4 alan-agius4 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 4, 2024
@windmillcode0
Copy link
Author

Greetings at least can we get documentation on this command?

@windmillcode0
Copy link
Author

windmillcode0 commented Mar 4, 2024

I've gone and found this package https://www.npmjs.com/package/vite-bundle-analyzer
and for anyone needding to know how to use it

ng build && cd  [PROJECT PATH NAME HERE NO BRACKETS]/[browser or server IF YOU USED SSR NO BRACKETS] &&  vite-bundle-visualizer    --open

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants