A Rollup plugin that renames the `node_modules` directory in the output when bundling with `preserveModules` and also rewrites relative imports to point to the new folder. Version 1.3.1 is the latest stable release. It addresses a common npm publishing issue where npm ignores `node_modules` in the output directory. Supports a custom replacer function (since 1.3.0), optional source map generation (since 1.2.0), and requires Rollup 2.28.2+ and Node 8+. This is a niche utility for library authors bundling dependencies with `preserveModules`.
npm install rollup-plugin-rename-node-modulesVerified import paths — ran on the pinned version, not inferred.
Basic Rollup config using the plugin with a custom folder name to avoid npm's node_modules ignore behavior.
Ensure the output structure matches expectations; test with nested modules.
Use the second argument to toggle source map generation. Passing `false` is valid.
Test the replacer with expected input strings.
Upgrade Rollup to >=2.28.2.
Run `npm install rollup-plugin-rename-node-modules --save-dev`
Use `import renameNodeModules from 'rollup-plugin-rename-node-modules'`
Verify that the first argument is a string or function; check Rollup config.