whybundled icon indicating copy to clipboard operation
whybundled copied to clipboard

Webpack 5 Support

Open Aghassi opened this issue 1 year ago • 3 comments

This package does not support the stats file that webpack 5 creates and errors with the following:

❯ npx whybundled webpack-stats/webpack-stats.json
(stats.chunks || []).forEach is not a function

I'm making this issue to track the problem publicly, but I don't have the time right now to contribute the fix.

Aghassi avatar Jul 13 '22 17:07 Aghassi

It is also possible that my stats are messed up because I had certain outputs set to false. Would be helpful to at least catch this error if chunks are false like in my case and then notify the user to check their webpack config.

Aghassi avatar Jul 13 '22 17:07 Aghassi

Thank you for raising this. Could you please attach the stats file?

d4rkr00t avatar Jul 13 '22 21:07 d4rkr00t

I'll have to make a public repro that isn't with my company's code, but basically https://github.com/d4rkr00t/whybundled/blob/master/lib/normalize-stats.ts#L7 should not assume an array as chunks (even though webpack docs say that... annoying). In our case the entry is the first object in a map lookup and then that has the array you want. I'll have to try and make a repro to post here in my free time.

Aghassi avatar Jul 20 '22 16:07 Aghassi