{"library":"modify-source-webpack-plugin","title":"Modify Source Webpack Plugin","description":"Webpack plugin that allows modification of module source code during compilation via hook functions. Current version 4.1.0 works with Webpack 4 and 5. It uses webpack loader mechanism internally to transform sources, supporting watch mode re-compilation. Key differentiators: cleaner API compared to using raw loaders for conditional modifications; provides access to module path and source; handles loader option serialization issues internally. Release cadence is ad-hoc with breaking changes between major versions (rejection of global variable in v4). Ships TypeScript definitions.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install modify-source-webpack-plugin"],"cli":null},"imports":["import ModifySourcePlugin from 'modify-source-webpack-plugin'","const ModifySourcePlugin = require('modify-source-webpack-plugin')","import type { PluginOptions } from 'modify-source-webpack-plugin'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// webpack.config.js\nconst ModifySourcePlugin = require('modify-source-webpack-plugin');\n\nmodule.exports = {\n  plugins: [\n    new ModifySourcePlugin({\n      rules: [\n        {\n          test: /\\.js$/,\n          modify: (source, path) => source.replace('foo', 'bar'),\n        },\n      ],\n    }),\n  ],\n};","lang":"javascript","description":"Replaces all occurrences of 'foo' with 'bar' in .js files during webpack compilation.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}