Created
December 11, 2020 08:53
-
-
Save ecklf/207d0b3e062fcd97b50484e54210685e to your computer and use it in GitHub Desktop.
lodash-webpack-plugin webpack 5 patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/lodash-webpack-plugin/lib/index.js b/node_modules/lodash-webpack-plugin/lib/index.js | |
index d791223..2aca193 100644 | |
--- a/node_modules/lodash-webpack-plugin/lib/index.js | |
+++ b/node_modules/lodash-webpack-plugin/lib/index.js | |
@@ -84,13 +84,17 @@ function () { | |
/* Webpack >= 4 */ | |
if (compiler.hooks) { | |
+ const webpackVersion = parseInt(require('webpack/package.json').version, 10) | |
+ | |
compiler.hooks.normalModuleFactory.tap('LodashModuleReplacementPlugin', function (nmf) { | |
nmf.hooks.afterResolve.tap('LodashModuleReplacementPlugin', function (data) { | |
if (data) { | |
data.resource = resolve(data); | |
} | |
- return data; | |
+ if (webpackVersion < 5) { | |
+ return data | |
+ } | |
}); | |
}); | |
} else { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment