Babel helper to insert module imports programmatically in AST transforms. v7.0.0-beta.3 is a prerelease of the 7.x series, part of the Babel ecosystem. This package provides functions like addDefault, addNamed, addSideEffect, and addNamespace to inject import statements during plugin execution. It abstracts away import creation, handling scoping, name collisions, and path insertion. The stable 7.x line is in maintenance; 8.x is in development with breaking changes. Key differentiator: designed for Babel plugin authors needing to add imports without manual AST construction.
npm install babel-helper-module-importsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates adding default and named imports in a Babel plugin using helper functions.
Refer to Babel 8 migration guide; test plugins against target version.
Prefer @babel/helper-module-imports in modern projects.
Use named imports only.
Ensure the first argument is a valid Babel path (e.g., path from visitor).