waysact/webpack-subresource-integrity

ignore error in ModuleFederationPlugin

guobin211 opened this issue ยท 1 comments

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch webpack-subresource-integrity@5.1.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/webpack-subresource-integrity/index.js b/node_modules/webpack-subresource-integrity/index.js
index 7c0c05b..4da1a66 100644
--- a/node_modules/webpack-subresource-integrity/index.js
+++ b/node_modules/webpack-subresource-integrity/index.js
@@ -88,7 +88,8 @@ class SubresourceIntegrityPlugin {
                     for (const chunkFile of chunk.files) {
                         if (chunkFile in records &&
                             records[chunkFile].source().includes(util_1.placeholderPrefix)) {
-                            reporter.errorOnce(`Asset ${chunkFile} contains unresolved integrity placeholders`);
+                            // patch-package ๅฟฝ็•ฅ webpack.ModuleFederationPlugin @michaeelbguo
+                            // reporter.errorOnce(`Asset ${chunkFile} contains unresolved integrity placeholders`);
                         }
                     }
                 }
@@ -134,6 +135,11 @@ class SubresourceIntegrityPlugin {
                     var _a;
                     const childChunks = plugin.getChildChunksToAddToChunkManifest(chunk);
                     if (childChunks.size > 0 && !chunk.hasRuntime()) {
+                        console.log('additionalChunkRuntimeRequirements', chunk);
+                        console.log('additionalChunkRuntimeRequirements.childChunks', childChunks);
+                        if (chunk.name === 'WebinarDetail') {
+                          return;
+                        }
                         compilation.addRuntimeModule(chunk, new AddLazySriRuntimeModule(util_1.generateSriHashPlaceholders(childChunks, this.options.hashFuncNames), (_a = chunk.name) !== null && _a !== void 0 ? _a : chunk.id));
                     }
                 });

This issue body was partially generated by patch-package.

Thanks, I'm glad you could hack around your problem but it's not really actionable to me so I'm going to close this.