Webpack plugin to replace strings in modules at configurable build stages. Version 0.0.20 supports three apply stages (loader, optimizeModules, optimizeChunkAssets) and match-count requirements with min/max constraints. Provides TypeScript types, inherited rule/replacement defaults, and validation logging. Differentiates from simple find-and-replace by allowing stage-specific application and output-file-based filtering.
npm install webpack-string-replacerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: require the plugin, add to webpack plugins with a rule to replace a token in a specific file.
Use fileInclude/fileExclude for source stages, outputFileInclude/outputFileExclude for chunk stage.
Use outputFileInclude/outputFileExclude instead.
Use require('webpack-string-replacer') or TypeScript import with '= require'.Ensure pattern flags match intended behavior; test with a simple string first.
Replace `import WebpackStringReplacer from 'webpack-string-replacer'` with `const WebpackStringReplacer = require('webpack-string-replacer')`.Verify the pattern exists in the file or reduce/remove the min requirement.
Choose one stage and use the corresponding include/exclude options.
Run `npm install --save-dev webpack-string-replacer` from project root.