Closed mredaelli closed 1 year ago
Which version of this plugin are you using, which version of Webpack?
webpack "5.72.1"
webpack-dev-middleware "5.3.1"
webpack-dev-server "4.9.0"
webpack-merge "5.8.0"
webpack-subresource-integrity "5.1.0"
Thanks. This looks like a bug, and your guess (0 being falsy) seems likely. The next step would be to create a failing test case, could you help with that?
Possibly, but I'm not really a frontend guy and webpack is one big black box to me.
Maybe if you can give some pointers. How do I mock a chunk with a particular id? I looked around in the unit tests but didn't get very far
I'd prefer an integration test rather than a mock. A test repository that demonstrates the issue would be perfect, I could turn that into a test easily. Do you have an idea which webpack config would generate a chunk with ID 0?
I'm afraid there's nothing I can do here without a repro.
I'd prefer an integration test rather than a mock. A test repository that demonstrates the issue would be perfect, I could turn that into a test easily. Do you have an idea which webpack config would generate a chunk with ID 0?
Set up a build on any Angular project with build options of subresourceIntegrity
set to true
and namedChunks
set to false
. The zeroth element in the list of transpiled scripts is excluded from the sriHashes
property. Happening currently on a repository I use for work but I'm not in a position to make it public.
This line is the source of the bug. When the depChunk.id
is 0
, the hash isn't added to the object.
We just ported our project to Angular 14, and suddenly started getting this error:
we tracked it down to a module being lazily loaded. Looking around, we found that its entry being missing from the
sriHashes
object inruntime.js
.Since:
it is for me very tempting to think that it is excluded from the dict because it's falsy.
Could it be because if this line?
https://github.com/waysact/webpack-subresource-integrity/blob/ad9265e2db2635abb4b75ff00f0f0dd6ecb14dff/webpack-subresource-integrity/util.ts#L105=