{"library":"module-replace-webpack-plugin","title":"module-replace-webpack-plugin","description":"A webpack plugin (v0.0.12, latest as of 2025) that replaces imported modules at build time, allowing monkey patching of third-party libraries without modifying source code. Designed for webpack 3.x only. Uses regex-based matching to swap `require`/`import` statements. No updates since 2018; limited compatibility and no support for webpack 4+ or ESM. Different from string-replace-loader as it operates on module resolution rather than string substitution.","language":"javascript","status":"abandoned","last_verified":"Sat Apr 25","install":{"commands":["npm install module-replace-webpack-plugin"],"cli":null},"imports":["const ModuleReplaceWebpackPlugin = require('module-replace-webpack-plugin');","new ModuleReplaceWebpackPlugin({ modules: [{ test: /lodash/, replace: './patched.js' }] })","new ModuleReplaceWebpackPlugin({ modules: [...], exclude: [/patched\\.js$/] })"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const ModuleReplaceWebpackPlugin = require('module-replace-webpack-plugin');\nconst path = require('path');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    filename: 'bundle.js',\n    path: path.resolve(__dirname, 'dist')\n  },\n  plugins: [\n    new ModuleReplaceWebpackPlugin({\n      modules: [{\n        test: /lodash/,\n        replace: './src/patchedLodash.js'\n      }],\n      exclude: [/patchedLodash\\.js$/]\n    })\n  ]\n};","lang":"javascript","description":"Configures webpack to replace all imports matching /lodash/ with a local patched file, excluding the patched file itself from replacement.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}