Skip to content
PluginStats

babel-plugin-add-module-exports weekly downloads statistics

By 59naga · npm · Babel plugins

Fix babel/babel#2212

View on npm Fresh · Dec 6, 2026

babel-plugin-add-module-exports has 1,334,039 recorded weekly downloads on npm, a decrease of 2.6% over the past 30 days, ranking #262 of 3,247 tracked listings.

Weekly downloads
1,334,039
Official API · Dec 5, 2026
7-day growth
+14.5%
+168.8K weekly downloads
30-day growth
-2.6%
-36K weekly downloads
90-day growth
+47.8%
+431.6K weekly downloads
Rank
#262
▲ 12 in 7 days

About babel-plugin-add-module-exports

babel-plugin-add-module-exports

<p align="right"> <a href="https://npmjs.org/package/babel-plugin-add-module-exports"> <img src="https://img.shields.io/npm/v/babel-plugin-add-module-exports.svg?style=flat-square"> </a> <a href="https://travis-ci.org/59naga/babel-plugin-add-module-exports"> <img src="http://img.shields.io/travis/59naga/babel-plugin-add-module-exports.svg?style=flat-square"> </a> </p>

Why?

Babel@6 doesn't export default module.exports any more - T2212 Kill CommonJS default export behavior.

Babel@6 transforms the following file

export default 'foo'

into

'use strict';
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = 'foo';

Therefore, it is a need to use the ugly .default in node.js.

require('./bundle.js') // { default: 'foo' }
require('./bundle.js').default // 'foo'

This plugin follows the babel@5 behavior - add the module.exports if only the export default declaration exists.

'use strict';
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = 'foo';
module.exports = exports['default'];

Therefore, our old codes still work fine - the .default goes away. :wink:

require('./bundle.js') // foo

Usage

Install this plugin from npm:

npm install babel-plugin-add-module-exports --save-dev
# or
yarn add -D babel-plugin-add-module-exports

Write the name to babelrc. It works with preset-env to output CommonJS code:

{
  "presets": ["@babel/env"],
  "plugins": ["add-module-exports"]
}
modules: false

However, the plugin doesn't change the pure-esmodule. this plugin makes changes only when exists exports.default (in other words, using commonjs).

{
  "presets": [["@babel/env", { "modules": false }]],
  "plugins": ["add-module-exports"]
}

into

export default 'foo'

1.0.0 Currently support is commonjs and umd. Doesn't support amd, systemjs modules(don't use. there are no plans to support at the moment).

with Webpack

Likewise, webpack doesn't perform commonjs transformation for codesplitting. Need to set commonjs conversion.

{
  "presets": [["@babel/env", { "modules": "commonjs" }]],
  "plugins": ["add-module-exports"]
}

Options

addDefaultProperty

If you're exporting an object and wish to maintain compatibility with code using the require('./bundle.js').default syntax, you can optionally enable the addDefaultProperty option as follows:

{
  "presets": ["env"],
  "plugins": [
    [
      "add-module-exports",
      {
        "addDefaultProperty": true
      }
    ]
  ]
}

This will cause a second line of code to be added which aliases the default name to the exported object like so:

module.exports = exports['default'];
module.exports.default = exports['default']

See also

License

MIT

Description from the npm listing.

  • babel-plugin
  • module.exports

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-add-module-exports weekly downloads on npm, last 90 days: 1,334,039 weekly downloads as of Dec 5, 2026, +47.8% over 90 days.babel-plugin-add-module-exportsWeekly downloads on npm · Last 90 days1,334,039downloads / week+47.8% over 90 days0200K400K600K800K1M1.2M1.4MSep 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-add-module-exports weekly downloads on npm, last 90 days: 1,334,039 weekly downloads as of Dec 5, 2026, +47.8% over 90 days.

7/30/90-day growth

babel-plugin-add-module-exports weekly downloads growth on npm: +14.5% over 7 days, -2.6% over 30 days, +47.8% over 90 days.babel-plugin-add-module-exportsWeekly downloads growth on npm1,334,039downloads / week now7-day growth+168,752 weekly downloads+14.5%30-day growth-36,021 weekly downloads-2.6%90-day growth+431,620 weekly downloads+47.8%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
babel-plugin-add-module-exports weekly downloads growth on npm: +14.5% over 7 days, -2.6% over 30 days, +47.8% over 90 days.

Ranking history

babel-plugin-add-module-exports npm ranking history: currently #262 (by weekly downloads).babel-plugin-add-module-exportsnpm ranking · by weekly downloads · Last 90 days#262current rank#50#100#150#200#250#300Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 17, 2026 – Dec 6, 2026 · 45 observations · Updated Dec 5, 2026pluginstats.com
babel-plugin-add-module-exports npm ranking history: currently #262 (by weekly downloads).

Listing placement

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

Listing placement

Babel plugins263 listings · 14 pages · page 7, #16 (overall #136)
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 (592)
Recent weekly downloads observations for babel-plugin-add-module-exports
Date (UTC)Weekly downloadsChange vs. previous
1,334,039+13.2K
1,320,816+49.3K
1,271,557+54.2K
1,217,407+27.1K
1,190,356+18.3K
1,172,054+9.4K
1,162,693-2.6K
1,165,287-911
1,166,198-33.7K
1,199,918-47.5K
1,247,434-27.7K
1,275,103+8.6K
1,266,510+10.2K
1,256,263—

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