webpack-contrib / webpack-bundle-analyzer

Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap
MIT License
12.56k stars 483 forks source link

Stats parsing is broken Webpack 5 #530

Open maciej-panecki-wttech opened 1 year ago

maciej-panecki-wttech commented 1 year ago

Issue description

I receive error: Error parsing bundle asset "...": Cannot read properties of undefined (reading 'arguments') inside the file of parseUtils.js line 254:

const minId = isOptimizedArray ? // Get the [minId] value from the Array() call first argument literal value
    node.callee.object.arguments[0].value : // `0` for simple array
    0;

node.callee.object is undefined which throws an error.

Technical info

  System:
    OS: macOS 12.6
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 66.48 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v10.24.1/bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
  npmPackages:
    clean-webpack-plugin: ^3.0.0 => 3.0.0 
    copy-webpack-plugin: ^10.1.0 => 10.2.4 
    css-minimizer-webpack-plugin: ^3.2.0 => 3.4.1 
    eslint-webpack-plugin: ^3.1.1 => 3.2.0 
    html-webpack-plugin: ^5.5.0 => 5.5.0 
    stylelint-webpack-plugin: github:panec/stylelint-webpack-plugin => 3.3.0 
    terser-webpack-plugin: ^5.2.5 => 5.3.6 
    tsconfig-paths-webpack-plugin: ^3.2.0 => 3.5.2 
    webpack: ^5.65.0 => 5.74.0 
    webpack-bundle-analyzer: ^4.6.1 => 4.6.1 
    webpack-cli: ^4.9.1 => 4.10.0 
    webpack-dev-server: ^4.6.0 => 4.11.1 
    webpack-merge: ^5.8.0 => 5.8.0 

Debug info

I generate json from webpack:

new BundleAnalyzerPlugin({
            analyzerMode: "disabled",
            generateStatsFile: true
        }),

and try to analyse it using this CLI: npx webpack-bundle-analyzer dist/stats.json

maciej-panecki-wttech commented 1 year ago

stats.json.zip

eamodio commented 1 year ago

I'm seeing the same thing, but only on some of my assets