{"id":22145,"library":"rollup-plugin-node-copy","title":"rollup-plugin-node-copy","description":"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.","status":"maintenance","version":"1.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/justintaylor-dev/rollup-plugin-node-copy","tags":["javascript","rollup","plugin","copy","node","module","bundle"],"install":[{"cmd":"npm install rollup-plugin-node-copy","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-node-copy","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-node-copy","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for plugin interface","package":"rollup","optional":false}],"imports":[{"note":"Package exports a default function; ESM preferred. CommonJS require also works but may lack type defs.","wrong":"const nodeCopy = require('rollup-plugin-node-copy')","symbol":"nodeCopy","correct":"import nodeCopy from 'rollup-plugin-node-copy'"},{"note":"Not a named export; use default import or require.","wrong":"import { nodeCopy } from 'rollup-plugin-node-copy'","symbol":"nodeCopy","correct":"const nodeCopy = require('rollup-plugin-node-copy')"},{"note":"No subpath exports; incorrect path will fail.","wrong":"import nodeCopy from 'rollup-plugin-node-copy/default'","symbol":"default","correct":"import nodeCopy from 'rollup-plugin-node-copy'"}],"quickstart":{"code":"import nodeCopy from 'rollup-plugin-node-copy';\n\nexport default {\n  input: 'src/index.js',\n  output: { dir: 'dist', format: 'cjs' },\n  plugins: [\n    nodeCopy({\n      packages: ['jimp'],\n      src: './',\n      dest: 'public/web',\n      symlink: false\n    })\n  ]\n};","lang":"javascript","description":"Demonstrates copying the jimp package and its dependencies to public/web/node_modules when Rollup cannot bundle it."},"warnings":[{"fix":"Verify that the target module is not resolvable by other plugins before resorting to copying.","message":"The plugin copies entire packages and their dependencies, which can bloat the output. Use only for modules that truly cannot be bundled.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use symlink: false for production builds.","message":"symlink: true creates symlinks to the source node_modules, which may cause issues with relative paths or absolute paths in production deployments.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure the source directory has a node_modules folder at the expected location.","message":"The src path must contain a top-level node_modules folder. If src is './', the plugin looks for './node_modules/'.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"After copying, mark the package as external: external: ['jimp'] in Rollup config.","cause":"The plugin copies the package but Rollup still tries to resolve it and fails if not properly handled.","error":"Error: Cannot find module 'jimp' when using rollup-plugin-node-copy"},{"fix":"Use import nodeCopy from 'rollup-plugin-node-copy' or const nodeCopy = require('rollup-plugin-node-copy').","cause":"Incorrect import style (named import instead of default).","error":"TypeError: nodeCopy is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}