Skip to content
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

integrity missing from namedChunkGroups assets #163

Closed
jarrett-confrey opened this issue Jul 28, 2021 · 1 comment
Closed

integrity missing from namedChunkGroups assets #163

jarrett-confrey opened this issue Jul 28, 2021 · 1 comment

Comments

@jarrett-confrey
Copy link

integrity is in stats.toJson().assets but not stats.toJson().namedChunkGroups.assets. i noticed this when working with loadable-components. i have gregberge/loadable-components#803 (packages/webpack-plugin/src/index.js) to add integrity to namedChunkGroups but im curious if it might be better to do so in this library instead or as well

@jscheid
Copy link
Collaborator

jscheid commented Jul 29, 2021

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?

@jscheid jscheid closed this as completed Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants