Webpack bundle analyser is not working in the project with angular 18 version

I am working on angular 18 framework and I recently tried to integrate webpack bundle analyser in my project but it’s giving me a weird error.I thought the issue is with my project so created a new dummy angular 18 project with angular cli and Tried there as well but the issue still remains.Tried exploring about it but didn’t get any possible solution for the issue.
I simply installed the package in the project then ran ng build –stats-json which created stats.json file in dist/project name folder.
Now when I run the command to analyse this json file by going to the particular folder it is giving error.
I ran npx web-pack-analyser stats.json and it gives error as:

can’t analyse webpack bundle:
type error: cannot read properties of undefined reading filter.

I am referring the videos on YouTube to add this package but it is not working.