webpack-deduplication-plugin icon indicating copy to clipboard operation
webpack-deduplication-plugin copied to clipboard

Throwing error with Webpack 5

Open randing89 opened this issue 4 years ago • 0 comments

The plugin is throwing following error with Webpack 5

Error: NormalModuleFactory.beforeResolve is no longer a waterfall hook, but a bailing hook instead. Do not return the passed object, but modify it instead. Returning false will ignore the request and results in no module created.

Removing the return in beforeResolve seems to fix the issue. Not sure if it will break Webpack 4.

diff --git a/node_modules/webpack-deduplication-plugin/build/index.js b/node_modules/webpack-deduplication-plugin/build/index.js
index 083955b..9a62d23 100644
--- a/node_modules/webpack-deduplication-plugin/build/index.js
+++ b/node_modules/webpack-deduplication-plugin/build/index.js
@@ -182,7 +182,7 @@ var WebpackDeduplicationPlugin = /*#__PURE__*/function () {
       var dupVals = Object.values(duplicates);
       compiler.hooks.normalModuleFactory.tap('WebpackDeduplicationPlugin', function (nmf) {
         nmf.hooks.beforeResolve.tap('WebpackDeduplicationPlugin', function (result) {
-          return deduplicate(result, dupVals);
+          deduplicate(result, dupVals);
         });
       });
     }

randing89 avatar Jan 13 '21 07:01 randing89