A Babel plugin (v1.1.3) that transforms wildcard import declarations into explicit import statements by scanning the filesystem at compile time. Supports single (*) and double (**) asterisk patterns, snake_case naming, and custom file extensions. Unlike dynamic require or Webpack require.context, this plugin produces static imports suitable for tree-shaking.
npm install babel-plugin-import-recursiveVerified import paths — ran on the pinned version, not inferred.
Shows basic usage with the double-asterisk pattern to import all files recursively from a directory.
Ensure the import path is a relative literal string, not a variable or computed expression.
Use consistent file naming (no special characters) or adjust option to match your naming convention.
If you need default exports, use a different pattern or manually re-export.
Add 'ts' and 'tsx' to the 'exts' array if you use TypeScript.
Add 'import-recursive' to your Babel plugins list.
Ensure babel-plugin-import-recursive is installed and included in Babel config.