Closed jarrett-confrey closed 3 years ago
Thanks for the suggestion, it did sound reasonable at first. But on closer inspection it turns out that in terms of the official typings, elements of stats.toJson().assets
are explicitly designed to receive custom properties (via & Record<string, any>
): https://github.com/webpack/webpack/blob/60d8968cd48cf1677df5f50ed878c6a912e9d692/types.d.ts#L10597
... whereas elements of stats.toJson().namedChunkGroups.assets
are not: https://github.com/webpack/webpack/blob/60d8968cd48cf1677df5f50ed878c6a912e9d692/types.d.ts#L5466
This means implementing your suggestion would require casting the type, which I'd like to avoid.
Also, the records in namedChunkGroups
being typed differently, I think it's clear they are not meant to be treated as copies of the records at the top level. Perhaps you should also consider designing this differently in your lib, or asking the Webpack devs for clarification, if you want to be sure this is going to continue to work in future Webpack versions?
integrity
is instats.toJson().assets
but notstats.toJson().namedChunkGroups.assets
. i noticed this when working withloadable-components
. i have https://github.com/gregberge/loadable-components/pull/803 (packages/webpack-plugin/src/index.js
) to addintegrity
tonamedChunkGroups
but im curious if it might be better to do so in this library instead or as well