A Rollup plugin that replaces module imports with a specified string shim, useful for stripping out dev-time dependencies like 'debug' in production builds. Stable at v1.0.0 since 2017, with minimal releases. Unlike rollup-plugin-alias, this plugin replaces the module content inline with a string rather than pointing to another file, making it ideal for small shims. Best for simple noop replacements; for complex aliasing, use rollup-plugin-alias instead. Active maintenance is low, but the plugin works with Rollup 0.x and 1.x.
npm install rollup-plugin-shimVerified import paths — ran on the pinned version, not inferred.
Shows how to configure the plugin to replace 'debug' and 'fs' imports with noop stubs in a Rollup config.
Use distinct keys or handle per-module with custom resolve.
Ensure shim strings are valid JavaScript/ES module syntax.
Test with your Rollup version; consider using '@rollup/plugin-alias' or newer alternatives.
Use full paths or bare specifiers as they appear in import statements.
Correct the shim string to be valid ES module syntax.
Use default import: `import shim from 'rollup-plugin-shim'`.
Run `npm install rollup-plugin-shim --save-dev` or `yarn add -D rollup-plugin-shim`.