babel-plugin-add-module-exports weekly downloads statistics
By 59naga · npm · Babel plugins
Fix babel/babel#2212
babel-plugin-add-module-exports has 507,580 recorded weekly downloads on npm, a decrease of 45.7% over the past 30 days, ranking #257 of 2,256 tracked listings.
About babel-plugin-add-module-exports
babel-plugin-add-module-exports
Why?
Babel@6 doesn't export default module.exports any more - T2212 Kill CommonJS default export behavior.
Babel@6 transforms the following file
into
Therefore, it is a need to use the ugly .default in node.js.
This plugin follows the babel@5 behavior - add the module.exports if only the export default declaration exists.
Therefore, our old codes still work fine - the .default goes away. :wink:
Usage
Install this plugin from npm:
Write the name to babelrc. It works with preset-env to output CommonJS code:
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).
into
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.
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:
This will cause a second line of code to be added which aliases the default name to the exported object like so:
See also
• babel-plugin-experimental-syntax-dynamic-import
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
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 (543)Similar npm Babel plugins plugins
All 20 babel-plugin-add-module-exports 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/babel-plugin-add-module-exports. First seen Oct 16, 2026; last successful collection Oct 19, 2026. See the methodology.