-
-
Notifications
You must be signed in to change notification settings - Fork 490
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
Allowing capability to parse bundles that have child assets generated, along with main asset #376
Conversation
@jsf-clabot rerun |
Seems like the first commit in this PR has an email address associated with it that is not associated with your GitHub account. You will need to fix that e.g. with interactive rebasing and resetting the commit author details, and then force pushing your changed branch here to fix CLA check. |
…o be added to the bundle analyzer charts.
@valscion : I've fixed the cla issues now, please review the changeset and lmk if it looks ok. |
I do appreciate the tests you added. I'm unfortunately not so knowledgeable in the specific codepath you're changing, so I'll defer to @th0r for reviewing. Is there something in particular in this diff that you could do differently @masterkidan or that you think could cause issues in the future? Is there something that you think could cause maintenance burden? |
Nothing springs to my mind here, let’s wait for @th0r to review. |
@th0r: A gentle ping for a review, I would like to get this in so that I can unblock some local debugging issues am having with large bundle sizes for workers. |
Oh well, we can always fix any problems that arise if this code breaks. We also have a test case for this, and the code seems quite OK to me Let's move ahead with this one. Thank you for the contribution, @masterkidan |
Thanks @valscion: Is it possible to get a patch/minor release with the above changes so that I can consume the updates? Will it get generated automatically? |
Yeah I was in the progress of releasing a new version yesterday but then my time ran out. It's been a while since there was an update, so I'm looking at if I can also bump some dependencies in a backwards compatible manner before I release a new version. I'll try to remember to comment here when we release a new version. I can't promise any given timeline, as it depends on when I have a nice time slot to do the update. |
I was having some large worker bundle issues, so I ended up pulling master and trying this out. I ran into an issue where an error is thrown because Here's a quick fix if you want one: #378 With that, this works great and I'm able to see worker bundle stats now 😃 |
Thanks for testing these changes, @dabbott! |
When trying to analyze a stats.json for a webpack bundle generated off of an array webpack.config.json webpack-bundle-analyzer was throwing: Could't analyze webpack bundle: TypeError: Cannot read property 'assets' of undefined This bug was probably introduced in webpack-contrib#376 Example webpack config to generate a stats.json file that causes the crash: ```js function getConfig({ config }) { return { mode: 'production', entry: './src/index.js', performance: { hints: 'warning', }, optimization: { minimize: true, }, output: { filename: `${config}-[name].js`, chunkFilename: `${config}-chunk-[name].js`, path: `${__dirname}/`, }, }; } module.exports = [{ config: 'config-1' }, { config: 'config-2' }].map(getConfig); ```
When trying to analyze a stats.json for a webpack bundle generated off of an array webpack.config.json webpack-bundle-analyzer was throwing: Could't analyze webpack bundle: TypeError: Cannot read property 'assets' of undefined This bug was probably introduced in webpack-contrib#376 Example webpack config to generate a stats.json file that causes the crash: ```js function getConfig({ config }) { return { mode: 'production', entry: './src/index.js', performance: { hints: 'warning', }, optimization: { minimize: true, }, output: { filename: `${config}-[name].js`, chunkFilename: `${config}-chunk-[name].js`, path: `${__dirname}/`, }, }; } module.exports = [{ config: 'config-1' }, { config: 'config-2' }].map(getConfig); ```
When trying to analyze a stats.json for a webpack bundle generated off of an array webpack.config.json webpack-bundle-analyzer was throwing: Could't analyze webpack bundle: TypeError: Cannot read property 'assets' of undefined This bug was probably introduced in webpack-contrib#376 Example webpack config to generate a stats.json file that causes the crash: ```js function getConfig({ config }) { return { mode: 'production', entry: './src/index.js', performance: { hints: 'warning', }, optimization: { minimize: true, }, output: { filename: `${config}-[name].js`, chunkFilename: `${config}-chunk-[name].js`, path: `${__dirname}/`, }, }; } module.exports = [{ config: 'config-1' }, { config: 'config-2' }].map(getConfig); ```
This essentially attempts to solve #150, when worker-loader is used it generates bundles with the following compilation stat
1 main asset
Children Assets
The main chunk that is emitted bundle.worker.js, doesn't have any children associated with, the webpack compiler instead spits out the dependencies as part of stats.children.assets.
This PR attempts to solve the above by traversing the children assets and constructing trees for them as well.