webpack-plugin-replace weekly downloads statistics
By lukeed (2 listings) · npm · Webpack plugins
Replace content while bundling.
webpack-plugin-replace has 13,110 recorded weekly downloads on npm, a decrease of 1.5% over the past 30 days, ranking #1181 of 3,247 tracked listings.
About webpack-plugin-replace
webpack-plugin-replace 
Replace content while bundling.
Install
$ npm install --save-dev webpack-plugin-replace
Usage
// webpack.config.js
const ReplacePlugin = require('webpack-plugin-replace');
module.exports = {
// ...
plugins: [
new ReplacePlugin({
exclude: [
'foo.js',
/node_modules/,
filepath => filepath.includes('ignore')
],
patterns: [{
regex: /throw\s+(new\s+)?(Type|Reference)?Error\s*\(/g,
value: 'return;('
}],
values: {
'process.env.NODE_ENV': JSON.stringify('production'),
'FOO_BAR': '"hello world"',
'DEV_MODE': false,
}
})
]
};
API
webpack-plugin-replace(options)
options.exclude
Type: Array|String|Function|RegExp<br>
Default: false
If multiple conditions are provided, matching any condition will exclude the filepath, which prevents any alterations.
Note: By default, nothing is excluded!
options.include
Type: Array|String|Function|RegExp<br>
Default: true
If multiple conditions are provided, matching any condition will include & scan the filepath for eligible replacements.
Note: By default, all filepaths are included!
options.patterns
Type: Array<br>
Default: []
An array of RegExp pattern definitions. Each definition is an object with regex <RegExp> and value <String|Function> keys. If value is a function, it takes the same arguments as String.prototype.relace.
options.values
Type: Object<br>
Default: {}
An object whose keys are strings that should be replaced and whose values are strings the replacements.
If desired, you may forgo the values key & declare your key:value pairs directly to the main configuration. For example:
{
exclude: /node_modules/,
values: {
'process.env.NODE_ENV': JSON.stringify('production'),
}
}
// is the same as:
{
exclude: /node_modules/,
'process.env.NODE_ENV': JSON.stringify('production'),
}
License
MIT © Luke Edwards
Description from the npm listing.
- bundle
- content
- plugin
- replace
- string
- text
- webpack
- webpack-plugin
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (170)Similar npm Webpack plugins plugins
All 20 webpack-plugin-replace alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/webpack-plugin-replace. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.