Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
lodash-webpack-plugin webpack 5 patch
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