babel-plugin-auto-import weekly downloads statistics
By PavelDymkov · npm · Babel plugins
Babel plugin for variable auto imports
babel-plugin-auto-import has 63,546 recorded weekly downloads on npm, a decrease of 4.2% over the past 30 days, ranking #722 of 3,247 tracked listings.
About babel-plugin-auto-import
babel-plugin-auto-import
Convert global variables to import statements
Examples
Example 1
.babelrc
{
"plugins": [[
"auto-import", {
"declarations": [
{ "default": "React", "path": "react" }
]
}
]]
}
In
React.createElement("div", null, []);
Out
import React from "react";
React.createElement("div", null, []);
Example 2
.babelrc
{
"plugins": [[
"auto-import", {
"declarations": [
{ "default": "React", "members": ["Component"], "path": "react" }
]
}
]]
}
In
class MyComponent extends Component { }
Out
import { Component } from "react";
class MyComponent extends Component { }
Example 3
Suitable for polyfilling browser built-ins (eg. window.fetch)
.babelrc
{
"plugins": [[
"auto-import", {
"declarations": [
{ "anonymous": ["fetch"], "path": "whatwg-fetch" }
]
}
]]
}
In
fetch("http://example.com/qwe");
Out
import "whatwg-fetch";
fetch("http://example.com/qwe");
Example 4
Generate import path by filename. [name] will be replaced to processed filename.
.babelrc
{
"plugins": [[
"auto-import", {
"declarations": [
{ "default": "styles", "path": "./[name].css" }
]
}
]]
}
In
component-name.js
// ...
<input className={styles.className} />
// ...
Out
import styles from "./component-name.css";
// ...
<input className={styles.className} />
// ...
You can process filename by "nameReplacePattern" and "nameReplaceString" options. It's processing like this:
"basename.js".replace(new RegExp(nameReplacePattern), nameReplaceString); // == [name]
By default
nameReplacePattern == "\\.js$";
nameReplaceString == "";
.babelrc
{
"plugins": [[
"auto-import", {
"declarations": [
{
"default": "styles", "path": "./[name].css",
"nameReplacePattern": "\.component\.js$", "nameReplaceString": ".styles"
}
]
}
]]
}
In
name.component.js
// ...
<input className={styles.className} />
// ...
Out
import styles from "./name.styles.css";
// ...
<input className={styles.className} />
// ...
Using with Create React App
If you don't want to eject your project, you can use react-app-rewired and customize-cra.
config-overrides.js
const { override, addBabelPlugins, disableEsLint } = require("customize-cra");
const autoImportPluginOptions = {
"declarations": [
{ "default": "React", members: ["Component"], "path": "react" }
]
};
module.exports = override(
...addBabelPlugins([require("babel-plugin-auto-import"), autoImportPluginOptions]),
disableEsLint(),
);
Description from the npm listing.
- babel-plugin
- import
- module
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 (135)Similar npm Babel plugins plugins
All 20 babel-plugin-auto-import 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-auto-import. First seen Nov 21, 2026; last successful collection Nov 21, 2026. See the methodology.