{"library":"string-replace-loader","title":"string-replace-loader","type":"library","description":"A Webpack loader that performs string or regex replacements on file contents during the build process. Version 3.3.0 is the latest stable release, with occasional minor/patch updates. It supports plain string replacement, RegExp replacement (via string with flags or RegExp object), multiple replacements in a single rule, callback-based dynamic replacement, and strict mode. Key differentiators: flexible configuration similar to String.prototype.replace, array of replacements, strict mode to ensure replacements occurred. Compared to alternatives like `replace-in-file-webpack-plugin` or `webpack-replace-loader`, this loader integrates directly into the loader chain and works per-file based on test patterns. Requires Webpack 5+ and Node.js 4+.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install string-replace-loader"],"cli":null},"imports":["module.exports = { module: { rules: [ { test: /\\.js$/, loader: 'string-replace-loader', options: { search: 'foo', replace: 'bar' } } ] } }"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/Va1/string-replace-loader","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/string-replace-loader","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        loader: 'string-replace-loader',\n        options: {\n          search: 'jQuery',\n          replace: 'window.$'\n        }\n      }\n    ]\n  }\n};","lang":"javascript","description":"Demonstrates basic replacement of 'jQuery' with 'window.$' in all .js files.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}