Skip to content

Analyzer getting parsing errors after upgrade to Webpack 5 for edge cases #409

@hasan-wajahat

Description

@hasan-wajahat

Issue description

I had been easily creating analyzer reports with my very old configuration of laravel-mix 2 (running webpack 2 underneath). Finally I have managed to upgrade our config to laravel mix 6 (running webpack 5). Webpack is correctly creating all my bundles and webpack-bundle-analyzer even creates a proper report for this configuration. But the anazlyer is also throwing the following errors:

Error parsing bundle asset "/Users/hasan/Web_Projects/idf/IDF-web/public/js/components/payment/checkoutForm.js": Cannot read property 'arguments' of undefined
Error parsing bundle asset "/Users/hasan/Web_Projects/idf/IDF-web/public/js/pages/designLeague/coach_panel.js": Cannot read property 'arguments' of undefined
Error parsing bundle asset "/Users/hasan/Web_Projects/idf/IDF-web/public/js/pages/designLeague/member_panel.js": Cannot read property 'arguments' of undefined
Error parsing bundle asset "/Users/hasan/Web_Projects/idf/IDF-web/public/js/pages/paymentMethods/create.js": Cannot read property 'arguments' of undefined
Error parsing bundle asset "/Users/hasan/Web_Projects/idf/IDF-web/public/js/pages/members/studentProfile.js": Cannot read property '0' of undefined

Sadly I don't get any more errors that would give me a clue why bundle is failing.

I think my issue is similar to problems mentioned in #327

Technical info

System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 940.84 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node
    Yarn: 1.22.10 - ~/.yarn/bin/yarn
    npm: 6.14.8 - ~/.nvm/versions/node/v14.15.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  npmPackages:
    brotli-webpack-plugin: ^1.1.0 => 1.1.0 
    browser-sync-webpack-plugin: ^2.3.0 => 2.3.0 
    webpack-bundle-analyzer: ^4.3.0 => 4.3.0 

Debug info

I am using it as a plugin and here is how I run it:

const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
  plugins: [
           new BundleAnalyzerPlugin({
                analyzerMode: 'static',
                reportFilename: `${path.resolve(__dirname, 'public/storage/bundle-analyzer')}/app-${DOTENV.APP_VERSION}.html`,
                openAnalyzer: false,
            }),
  ]
}

What other Webpack plugins were used?
I am not explicitly using any more plugins but laravel mix under the hood is using plugins for minification and versioning etc..

The stats file is attached below. Also no exception was thrown while creation of the stats file based on your recommended method (with analyzer disabled and source: false).

stats.json.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions