{"id":22077,"library":"rollup-plugin-import-manager","title":"rollup-plugin-import-manager","description":"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.","status":"active","version":"0.6.4","language":"javascript","source_language":"en","source_url":"https://github.com/UmamiAppearance/rollup-plugin-import-manager","tags":["javascript","add","cjs","es6","delete","dynamic","import","import-manager","modules"],"install":[{"cmd":"npm install rollup-plugin-import-manager","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-import-manager","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-import-manager","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for Rollup plugin interface","package":"rollup","optional":false},{"reason":"Used for source code transformations with source maps","package":"magic-string","optional":false}],"imports":[{"note":"Default export; ESM-only since v0.6.0","wrong":"const importManager = require('rollup-plugin-import-manager')","symbol":"importManager","correct":"import importManager from 'rollup-plugin-import-manager'"},{"note":"Named export also available, but default is recommended","wrong":"import importManager from 'rollup-plugin-import-manager'","symbol":"importManager","correct":"import { importManager } from 'rollup-plugin-import-manager'"},{"note":"Unit is a TypeScript type, use type import","wrong":"import { Unit } from 'rollup-plugin-import-manager'","symbol":"Unit","correct":"import type { Unit } from 'rollup-plugin-import-manager'"}],"quickstart":{"code":"import importManager from 'rollup-plugin-import-manager';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'esm'\n  },\n  plugins: [\n    importManager({\n      units: [\n        {\n          module: './old-module',\n          actions: [\n            { remove: true }\n          ]\n        },\n        {\n          createModule: './new-module',\n          insert: { after: './existing-module' },\n          actions: [\n            { add: { name: 'newExport' } }\n          ]\n        }\n      ]\n    })\n  ]\n};","lang":"typescript","description":"Demonstrates removing an import from './old-module' and adding a new import from './new-module' after './existing-module'."},"warnings":[{"fix":"Update to Node >=12 and use ESM imports (import statement).","message":"In v0.6.0, the plugin changed from CJS to ESM-only. Node <12 or projects using require() will break.","severity":"breaking","affected_versions":">=0.6.0"},{"fix":"Replace shorthand remove with { remove: true } inside actions.","message":"The 'shorthand' action for removing imports is deprecated since v0.5.0; use 'remove: true' in actions array instead.","severity":"deprecated","affected_versions":">=0.5.0 <0.6.0"},{"fix":"Check for existing members before adding, or use 'rename' to modify an existing member.","message":"When using 'add' action, the member is added even if it already exists, potentially causing duplicate imports.","severity":"gotcha","affected_versions":">=0.4.0"},{"fix":"Ensure module strings match source exactly (e.g., 'import('./foo')' needs module: './foo').","message":"Dynamic imports are parsed as strings; the module path must be exactly as written in code, including quotes.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'esm' for ES6 imports instead of 'es6'.","message":"In v0.5.0, the 'modType' option required different values; 'es6' changed to 'esm'.","severity":"breaking","affected_versions":">=0.5.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install via npm: npm install rollup-plugin-import-manager --save-dev, and use ESM import.","cause":"Missing package or wrong version (CJS/ESM mismatch).","error":"Error: Plugin could not be resolved. Ensure rollup-plugin-import-manager is installed."},{"fix":"Use default import: import importManager from 'rollup-plugin-import-manager'","cause":"Using named import instead of default import.","error":"TypeError: importManager is not a function"},{"fix":"npm install magic-string --save-dev","cause":"Missing peer dependency magic-string.","error":"Error: Cannot find module 'magic-string'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}