A Rollup plugin for programmatically manipulating import statements in ES6, CommonJS, and dynamic imports. Version 0.6.4 is the latest stable release, with weekly updates. Key features include adding, removing, renaming, and modifying imports, members, and modules. Supports regex selection, cut-and-paste, and debug output. Differentiates from other import plugins by supporting all three module systems and offering granular control via units and actions.
npm install rollup-plugin-import-managerVerified import paths — ran on the pinned version, not inferred.
Demonstrates removing an import from './old-module' and adding a new import from './new-module' after './existing-module'.
Update to Node >=12 and use ESM imports (import statement).
Replace shorthand remove with { remove: true } inside actions.Check for existing members before adding, or use 'rename' to modify an existing member.
Ensure module strings match source exactly (e.g., 'import('./foo')' needs module: './foo').Use 'esm' for ES6 imports instead of 'es6'.
Install via npm: npm install rollup-plugin-import-manager --save-dev, and use ESM import.
Use default import: import importManager from 'rollup-plugin-import-manager'
npm install magic-string --save-dev