Skip to content
PluginStats

babel-plugin-transform-replace-expressions weekly downloads statistics

By jviide · npm · Babel plugins

Replace JavaScript expressions with other expressions

View on npm Fresh · Dec 6, 2026

babel-plugin-transform-replace-expressions has 134,418 recorded weekly downloads on npm, a decrease of 12.1% over the past 30 days, ranking #595 of 3,247 tracked listings.

Weekly downloads
134,418
Official API · Dec 5, 2026
7-day growth
-1.3%
-1.8K weekly downloads
30-day growth
-12.1%
-18.4K weekly downloads
90-day growth
+9.3%
+11.4K weekly downloads
Rank
#595
▼ 23 in 7 days

About babel-plugin-transform-replace-expressions

babel-plugin-transform-replace-expressions CircleCI npm

Replace JavaScript expressions with other expressions.

Installation

$ yarn add --dev babel-plugin-transform-replace-expressions

Example

Input file:

const env = process.env.NODE_ENV;

typeof Hello === "number";

.babelrc:

{
  "plugins": [
    [
      "babel-plugin-transform-replace-expressions",
      {
        "replace": {
          "process.env.NODE_ENV": "\"production\"",
          "typeof Hello": "42"
        }
      }
    ]
  ]
}

Output:

const env = "production";

42 === "number";

Conflict resolution

A conflict happens when two replacements have the same Babel abstract syntax tree representation. For example expressions typeof A and typeof (A) are formatted differently but have the same AST representation as far as the plugin is concerned. In those situations the default is to raise an error, and can be overwritten by setting the option allowConflictingReplacements to true.

You can also always give the replacements as an array of key-value pairs. When allowConflictingReplacements is set to true the last conflicting replacement gets selected.

{
  "plugins": [
    [
      "babel-plugin-transform-replace-expressions",
      {
        "replace": [
          ["typeof A", "B"],
          ["typeof (A)", "C"]
        ],
        "allowConflictingReplacements": true
      }
    ]
  ]
}

Notes

  • Replacements are only applied to expressions. Therefore replacing DEBUG with false in const DEBUG = true does nothing, but for if (DEBUG) {} the result is if (false) {}.

  • Only full expressions count. You can't replace env in process.env.NODE_ENV, you have to replace process.env, which is a proper expression in Babel AST.

  • A replacement is only applied when the result is valid JavaScript. For example replacing a with 2 in the following code:

    a = 1;
    b = a;
    

    yields

    a = 1;
    b = 2;
    

License

This plugin is licensed under the MIT license. See LICENSE.

Description from the npm listing.

  • babel-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

babel-plugin-transform-replace-expressions weekly downloads on npm, last 90 days: 134,418 weekly downloads as of Dec 5, 2026, +9.3% over 90 days.babel-plugin-transform-replace-express…Weekly downloads on npm · Last 90 days134,418downloads / week+9.3% over 90 days020K40K60K80K100K120K140K160K180KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
babel-plugin-transform-replace-expressions weekly downloads on npm, last 90 days: 134,418 weekly downloads as of Dec 5, 2026, +9.3% over 90 days.

7/30/90-day growth

babel-plugin-transform-replace-expressions weekly downloads growth on npm: -1.3% over 7 days, -12.1% over 30 days, +9.3% over 90 days.babel-plugin-transform-replace-express…Weekly downloads growth on npm134,418downloads / week now7-day growth-1,800 weekly downloads-1.3%30-day growth-18,423 weekly downloads-12.1%90-day growth+11,419 weekly downloads+9.3%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
babel-plugin-transform-replace-expressions weekly downloads growth on npm: -1.3% over 7 days, -12.1% over 30 days, +9.3% over 90 days.

Ranking history

babel-plugin-transform-replace-expressions npm ranking history: currently #595 (by weekly downloads).babel-plugin-transform-replace-express…npm ranking · by weekly downloads · Last 90 days#595current rank#500#520#540#560#580#600Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
babel-plugin-transform-replace-expressions npm ranking history: currently #595 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,083 shown · page 30, #15 (overall #595)
All npm: every listing in weekly downloads order

Listing placement

Babel plugins263 listings · 14 pages · page 12, #16 (overall #236)
Babel 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 babel-plugin-transform-replace-expressions
Date (UTC)Weekly downloadsChange vs. previous
134,418-480
134,898+2.2K
132,673+3.8K
128,824+3.9K
124,922-1.2K
126,100-6K
132,114-4.1K
136,218-1.4K
137,582-8K
145,574-8.2K
153,786-5.5K
159,302-5.7K
165,043+3.7K
161,307—

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/babel-plugin-transform-replace-expressions. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.