Registry / devops / rollup-plugin-node-copy

rollup-plugin-node-copy

JSON →
library1.0.4jsnpmunverified

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-copy
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-NODE
R
rollup-plugin-node-copy
devopsjavascriptv1.0.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

nodeCopy
import nodeCopy from 'rollup-plugin-node-copy'
const nodeCopy = require('rollup-plugin-node-copy')
Package exports a default function; ESM preferred. CommonJS require also works but may lack type defs.
nodeCopy
const nodeCopy = require('rollup-plugin-node-copy')
import { nodeCopy } from 'rollup-plugin-node-copy'
Not a named export; use default import or require.
default
import nodeCopy from 'rollup-plugin-node-copy'
import nodeCopy from 'rollup-plugin-node-copy/default'
No subpath exports; incorrect path will fail.

Demonstrates copying the jimp package and its dependencies to public/web/node_modules when Rollup cannot bundle it.

import nodeCopy from 'rollup-plugin-node-copy'; export default { input: 'src/index.js', output: { dir: 'dist', format: 'cjs' }, plugins: [ nodeCopy({ packages: ['jimp'], src: './', dest: 'public/web', symlink: false }) ] };
Debug
Known issues
gotchaThe plugin copies entire packages and their dependencies, which can bloat the output. Use only for modules that truly cannot be bundled.
fix
Verify that the target module is not resolvable by other plugins before resorting to copying.
affects: >=1.0.0
gotchasymlink: true creates symlinks to the source node_modules, which may cause issues with relative paths or absolute paths in production deployments.
fix
Use symlink: false for production builds.
affects: >=1.0.0
gotchaThe src path must contain a top-level node_modules folder. If src is './', the plugin looks for './node_modules/'.
fix
Ensure the source directory has a node_modules folder at the expected location.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'jimp' when using rollup-plugin-node-copy
The plugin copies the package but Rollup still tries to resolve it and fails if not properly handled.
fix
After copying, mark the package as external: external: ['jimp'] in Rollup config.
TypeError: nodeCopy is not a function
Incorrect import style (named import instead of default).
fix
Use import nodeCopy from 'rollup-plugin-node-copy' or const nodeCopy = require('rollup-plugin-node-copy').
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
rolluprequiredpeer dependency required for plugin interface
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-node-copy — npm install rollup-plugin-node-copy · libregistry