Skip to content
PluginStats

webpack-string-replacer weekly downloads statistics

By Venryx · npm · Webpack plugins

Replace strings in webpack modules, with configurable apply-stage and match-count requirements.

View on npm Fresh · Dec 6, 2026

webpack-string-replacer has 718 recorded weekly downloads on npm, a decrease of 23.5% over the past 30 days, ranking #2176 of 3,247 tracked listings.

Weekly downloads
718
Official API · Dec 5, 2026
7-day growth
+18.5%
+112 weekly downloads
30-day growth
-23.5%
-221 weekly downloads
90-day growth
-4.3%
-32 weekly downloads
Rank
#2176
▼ 67 in 7 days

About webpack-string-replacer

Webpack String Replacer

Replace strings in webpack modules, with configurable apply-stage and match-count requirements.

Installation
npm install --save-dev webpack-string-replacer
Usage

Basic example:

const WebpackStringReplacer = require("webpack-string-replacer");

webpackConfig.plugins.push(new WebpackStringReplacer({
	rules: [{
		fileInclude: "targetFile.js",
		replacements: [
			{
				pattern: "MY_API_TOKEN",
				patternMatchCount: {min: 4},
				replacement: "lPP5BxQESO6VU4aUcKJLFg",
			},
		],
	}],
}));

Advanced example:

const WebpackStringReplacer = require("webpack-string-replacer");

webpackConfig.plugins.push(new WebpackStringReplacer({
	logAroundPatternMatches: 200,
	rules: [{
		applyStage: "optimizeChunkAssets",
		outputFileInclude: /\.js$/,
		outputFileExclude: /vendors.js$/,
		outputFileMatchCount: 6,
		replacements: [
			{
				pattern: 'location.reload();',
				patternMatchCount: {min: 4, max: 10},
				replacement: '//location.reload();',
			},
			{
				pattern: /location\.href = (.+);/g,
				replacement: (match, sub1, offset, sourceStr)=> {
					return (
						`location.href_disabled = ${sub1};
						Log("Redirect attempted to: " + location.href_disabled);`
					);
				},
			},
		],
	}],
}));
Options

If you prefer viewing the raw TypeScript typings, you can open the "Source/Options.ts" file, or the "Dist/*.d.ts" files.

shouldValidate - bool | ({compilations: Compilation[]})=>bool

If set, the validations (eg. match-count requirements) will only be run when the condition is met (at the end of a compilation run).

validationLogType - "error" | "logError" | "logWarning" | "log"

What type of logging to use for validation failures, eg. match-count not being met. (error: throw new Error(...), the others: console.X(...))

ruleBase - Partial<Rule>

If set, each rule will "inherit" from the options specified here.

replacementBase - Partial<Replacement>

If set, each replacement entry will "inherit" from the options specified here.

rules - Rule[]

Array of rules. (see below)

rules.X.applyStage - "loader" | "optimizeModules" | "optimizeChunkAssets"

loader (early)

Time: Applies before other loaders or plugins have modified the source files.
File basis: Replacements at this stage operate on the source-files, so include/exclude is based on source files (or chunk names), not the output files.
Example: Applies on original typescript source files, before typescript and babel have applied their transformations.
Compatibility: Using this mode prohibits use of the "outputFileInclude" and "outputFileExclude" props, since they can't be applied.

optimizeModules (middle)

Time: Applies after loaders, but alongside some other plugins (depends on exact hooks used, and plugin order).
File basis: Replacements at this stage operate on partially modified files. Include/exclude is still based on source files (or chunk names) though, not the output files.
Example: For Babel, there seems to currently be a conflict where Babel has only "partially applied" on certain files, leading to text malformations. (eg. if modifying webpack/hot/dev-server.js)
Compatibility: Using this mode prohibits use of the "outputFileInclude" and "outputFileExclude" props, since they can't be applied.

optimizeChunkAssets (late)

Time: Applies briefly before the output-files are actually emitted (eg. written to disk).
File basis: Replacements at this stage operate on the output-files, so include/exclude is based on output files (or chunk names), not the source files.
Example: Applies on the outputs of typescript and babel. (Chrome devtools, with sourcemaps disabled, can be used to help construct the replacements)
Compatibility: Using this mode prohibits use of the "fileInclude" and "fileExclude" props, since they can't be applied.

rules.X.chunkInclude - bool | {name: string} - or array of these

Identifies chunks to be included. (includes, then filters/excludes)

Examples: "main", "vendor"

Note: Chunk inclusion/exclusion might not work how you expect. Webpack seems to process chunks differently internally (eg. grouping them together more) than one would assume based on defined entry points and such. It's usually easier to use output-file inclusion/exclusion, as it has a clear output-file meaning/boundary.

rules.X.chunkExclude - bool | {name: string} - or array of these

Identifies chunks to be excluded. (includes, then filters/excludes)

rules.X.chunkMatchCount - number | {min?: number, max?: number}

Examples: 1, {min: 3, max: 5}

rules.X.outputFileInclude - bool | string | regex | function - or array of these

Identifies output-files to be included. (includes, then filters/excludes)

Examples: "bundle.js", "vendorBundle.js"

rules.X.outputFileExclude - bool | string | regex | function - or array of these

Identifies output-files to be excluded. (includes, then filters/excludes)

Examples: "bundle.js", "vendorBundle.js"

rules.X.outputFileMatchCount - number | {min?: number, max?: number}

Checked against the number of output-file matches, in all (unignored) chunks. (condition must be met for at least one compilation)

Examples: (see rules.X.chunkMatchCount)

rules.X.fileInclude - bool | string | regex | function - or array of these

Identifies files to be included. (includes, then filters/excludes)

Examples: true, string to contain, /regex to contain match for/, str=>CustomMatchLogic(str)

rules.X.fileExclude - bool | string | regex | function - or array of these

Identifies files to be excluded. (includes, then filters/excludes)

Examples: (see rules.X.fileInclude)

rules.X.fileMatchCount - number | {min?: number, max?: number}…

Description from the npm listing.

  • webpack
  • plugin
  • webpack-plugin
  • bundle
  • content
  • text
  • string
  • token
  • find
  • replace
  • replacer

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

webpack-string-replacer weekly downloads on npm, last 90 days: 718 weekly downloads as of Dec 5, 2026, -4.3% over 90 days.webpack-string-replacerWeekly downloads on npm · Last 90 days718downloads / week-4.3% over 90 days02004006008001K1.2K1.4K1.6KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
webpack-string-replacer weekly downloads on npm, last 90 days: 718 weekly downloads as of Dec 5, 2026, -4.3% over 90 days.

7/30/90-day growth

webpack-string-replacer weekly downloads growth on npm: +18.5% over 7 days, -23.5% over 30 days, -4.3% over 90 days.webpack-string-replacerWeekly downloads growth on npm718downloads / week now7-day growth+112 weekly downloads+18.5%30-day growth-221 weekly downloads-23.5%90-day growth-32 weekly downloads-4.3%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
webpack-string-replacer weekly downloads growth on npm: +18.5% over 7 days, -23.5% over 30 days, -4.3% over 90 days.

Ranking history

webpack-string-replacer npm ranking history: currently #2176 (by weekly downloads).webpack-string-replacernpm ranking · by weekly downloads · Last 90 days#2176current rank#1400#1500#1600#1700#1800#1900#2000#2100#2200Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
webpack-string-replacer npm ranking history: currently #2176 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,083 shown · page 109, #16 (overall #2,176)
All npm: every listing in weekly downloads order

Listing placement

Webpack plugins349 listings · 18 pages · page 5, #11 (overall #91)
Webpack plugins: every listing in weekly downloads order

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)
Recent weekly downloads observations for webpack-string-replacer
Date (UTC)Weekly downloadsChange vs. previous
718-2
720-63
783-39
822+62
760+68
692+80
612+6
606-3
609-47
656-18
674-45
719-25
744+15
729—

Similar npm Webpack plugins plugins

All 20 webpack-string-replacer alternatives

Data 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-string-replacer. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.