Rollup plugin (v1.0.4, last updated 2022) that brute-force copies Node.js modules and their dependencies into a target node_modules directory when Rollup cannot bundle them. Unlike typical resolve plugins that bundle imports, this plugin works around issues with native addons or impure modules by physically copying files to a destination folder (e.g., public/web/node_modules). Supports symlinking for development. Minimal configuration: pass an array of package names. No frequent releases; likely stable but unmaintained.
npm install rollup-plugin-node-copyVerified import paths — ran on the pinned version, not inferred.
Demonstrates copying the jimp package and its dependencies to public/web/node_modules when Rollup cannot bundle it.
Verify that the target module is not resolvable by other plugins before resorting to copying.
Use symlink: false for production builds.
Ensure the source directory has a node_modules folder at the expected location.
After copying, mark the package as external: external: ['jimp'] in Rollup config.
Use import nodeCopy from 'rollup-plugin-node-copy' or const nodeCopy = require('rollup-plugin-node-copy').