Rollup plugin that rewrites ES module import and dynamic import paths by prepending a string to each path. Version 2.0.0 is the latest stable release; maintained on an as-needed basis. It solves the problem of fragmented builds where dependencies reside in separate node_modules directories, enabling theme developers and platform owners to use standard web component tooling while keeping builds isolated. Differentiates from other path-rewriting plugins by focusing specifically on ESM imports in the context of legacy or multi-repo setups, with no external dependencies.
npm install rollup-plugin-rewrite-importsVerified import paths — ran on the pinned version, not inferred.
Configure Rollup to use rewriteImports, prepending a path to each import statement.
Use import syntax or require with .default, or downgrade to 1.x if CommonJS is required.
Ensure your runtime supports ESM or bundle with a tool that handles ESM-to-CJS conversion.
Use with care: ensure the prefix does not break valid import paths. Pair with rollup-plugin-auto-external or a resolve plugin to manage external dependencies.
Use dynamic import() or switch to import syntax, or add .default: const rewriteImports = require('rollup-plugin-rewrite-imports').default;Run `npm install rollup-plugin-rewrite-imports --save-dev`.
Use default import: import rewriteImports from 'rollup-plugin-rewrite-imports';
No dependency data recorded yet.