Repository navigation
Description
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).
Metadata
Metadata
Assignees
Type
Fields
Priority
Activity
hasan-wajahat commentedon Jan 18, 2021
So just wanted to share that the I am no longer seeing this error after I started using
optimization.runtimeChunk. Now my config is like this for optimization:I don't know if this issue should be closed based on this or whether bundle should work even if no special runtime file is created.
Also a point to note is that I needed an explicit runtime file because I have multiple entry point js files for single pages in my app.
gian1200 commentedon Jul 14, 2025
Not sure if related or not, but I'm having the same behaviour (error in log with correct Webpack build and report generation).
In my case, it is triggered when adding ESM support to Webpack configuration:
I have 5 entries, and 1 error line per Entry::
valscion commentedon Jul 14, 2025
I wonder if #649 has already resolved your issue @gian1200
Do try out the current unreleased version if it works.
gian1200 commentedon Jul 14, 2025
Oh, I saw that PR, but thought that it was already released. Will try to test it during the day/week (will need to read how to depend on unreleased code, first).
Update
How can I add it to my dependencies?
I tried this in the
package.jsonwithout success:"webpack-bundle-analyzer": "[email protected]/webpack-contrib/webpack-bundle-analyzer.git#5d37dc35172906a1bc916de9d434afbe4820ed3f"gian1200 commentedon Jul 15, 2025
@valscion, after manually reinventing the wheel, I was able to do it.
The error still appears. The issue happens here, line 338:
https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/5d37dc35172906a1bc916de9d434afbe4820ed3f/src/parseUtils.js#L332-L352
console.log(node):
Reason
node.callee.objectis undefinednode.arguments[0]exists, butnode.arguments[0].elementsornode.elementsdon't?alexander-akait commentedon Jul 15, 2025
@gian1200 Can you provide code that we try to parser (feel free to update like a file or gist if it is large)
gian1200 commentedon Jul 15, 2025
I'll try to build a reproducer 👍🏻
gian1200 commentedon Jul 30, 2025
Sorry for the delay.
Please find the reproducer in the following link https://github.com/gian1200/webpack-bundle-analyzer-reproducer-409.
Steps
Expected output
allow to catch parsing errors
alexander-akait commentedon Jul 30, 2025
@gian1200 Thanks for the report, yeah, there is a bug, we need improve parsing es modules here
allow to catch parsing errors (#667)
gian1200 commentedon Dec 12, 2025
Hello, is there any update on this? After updating webpack-bundle-analyzer (4.10.2 --> 5.1.0), I now see a stack trace that could help debugging it:
valscion commentedon Dec 15, 2025
This same error can be caused by multitude of different reasons. Please open a new issue with a minimal reproduction as this error stems from bundle parsing — so a stats.json file is not enough to debug the case.
hasan-wajahat commentedon Dec 15, 2025
Hi, I opened the original issue years ago. I don't know if the original issue is even a thing now or not.
We can close this issue if the original reported bug isn't relevant now.
valscion commentedon Dec 15, 2025
Yeah makes sense, let's do that.
gian1200 commentedon Dec 15, 2025
Hello, there is a reproducer in the comment above. It just needs to have its dependencies updates.
I'll create the new issue when returning home, but the reproducer still applies.
valscion commentedon Dec 16, 2025
Ah yeah sorry @gian1200! Just goes on to show how easy it is to miss out these things when the original thread opener has had a different issue than what is reported inline. Thanks for opening the new issue!