-
-
Notifications
You must be signed in to change notification settings - Fork 489
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
Cannot parse bundle #166
Comments
Hi, thanks for opening an issue :) this could be a parsing bug in webpack-bundle-analyzer. Could you also upload your stats JSON file? We'll need that to reproduce your issue |
@jfrolich I had the same error today with the same versions of webpack and this tool. The errors disappeared by supplying For example Give it a try, and let me know if it helps at all. |
I can confirm problem today( |
I have also experienced this problem. I can unfortunately not share the code or stats file due to licensing issues, but here are a couple observations from the project:
Here are the first and last module(s) from the offending bundle in hopes that it helps: (window.webpackJsonp=window.webpackJsonp||[]).push([[3],Array(47).concat([function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var a,o=t(547),i=(a=o)&&a.__esModule?a:{default:a};n.default=i.default,e.exports=n.default},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,n,t){"use strict";t(1039),t(554),t(180),t(92),t(289),t(228),t(550)}, function(e,n,t){var a=t(553);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};t(23)(a,o);a.locals&&(e.exports=a.locals)}])]); |
I'm running into the same issue since upgrading webpack from 3.5.5 to 4.6.0. My guess is that it is related to how webpack 4 does bundle splitting; Previously I was using Since commons chunk plugin is no longer a thing with webpack 4, I added this to my optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'all',
}
}
},
}, If I remove this config, bundle analyzer works fine but I only get one enormous Couldn't parse bundle asset "/Users/sdavenport/code/wealthsimple/terminal/build/dist/app-752436a7751cc885da7d.js".
Analyzer will use module sizes from stats file. |
Do you need more repro details? Let me know and I'll cook up an example repo. |
Actually I just stumbled across something odd that seems related. Initially I had this in my webpack config: optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'all',
}
}
},
}, I copied that regex from the webpack docs: https://webpack.js.org/plugins/split-chunks-plugin/#optimization-splitchunks However I was in there tweaking something else and I was like "that regex seems overly complex" so I changed it to this:
... and now bundle analyzer works! I flipped it back and forth a couple times for the sake of paranoia and it seems that: test: /[\\/]node_modules[\\/]/, // parse error, stat sizes only test: /\/node_modules\//, // works fine 🤷♂️ |
Ah I have that regex in my config too! Nice find! |
Ok nice! Great to hear that this is related to having a specific kind of config, and that it can be fixed on the application side before we get to fix it here. I think we have enough details to be able to reproduce this, but if anyone could create a small reproduction repository for this, we'd be in an even better position 👍 |
Should be fixed in |
@th0r @valscion Here is my optimization config: const optimization = {
splitChunks: {
cacheGroups: {
vendor: {
name: 'vendor',
test: /\/node_modules\//,
chunks: 'all',
priority: 0,
enforce: true,
},
},
},
}; |
@sandrocsimas please open a new issue and fill the issue template |
is there a solution to fix it |
This issue is fixed. @lixiushan please open a new issue with information we ask in the issue template if you still face problems. |
Issue description
error:
Technical info
Debug info
bundle supplied here: https://gist.github.com/jfrolich/b0e934b6645edfc116103b09b72a08bd
The text was updated successfully, but these errors were encountered: