Registry / devops / rollup-plugin-copy-merge

rollup-plugin-copy-merge

JSON →
library1.0.3jsnpmunverified

A Rollup plugin that copies files and folders with glob support and adds file merging capability on top of rollup-plugin-copy. Current version 1.0.3, stable, maintained. Key differentiator: allows merging multiple source files into a single destination file via the 'file' target property, unlike its predecessor. Requires Node >=14, ships TypeScript types, and relies on fs-extra, globby, and colorette as peer dependencies.

npm install rollup-plugin-copy-merge
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-COPY
R
rollup-plugin-copy-merge
devopsjavascriptv1.0.3
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

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

default
✓ import copy from 'rollup-plugin-copy-merge'
✗ const copy = require('rollup-plugin-copy-merge')
The package provides a default ESM export. CommonJS require will not work without .default.
RollupOptions
✓ import type { RollupOptions } from 'rollup'
✗ import { RollupOptions } from 'rollup-plugin-copy-merge'
RollupOptions is not exported by this plugin; import from 'rollup'.
CopyOptions
✓ import type { CopyOptions } from 'rollup-plugin-copy-merge'
TypeScript types are bundled; CopyOptions interface is exported for configuration.

Shows basic plugin usage in rollup.config.js, including copying single files, merging globs into a single file, and using glob patterns.

// rollup.config.js import copy from 'rollup-plugin-copy-merge' export default { input: 'src/index.js', output: { file: 'dist/app.js', format: 'cjs' }, plugins: [ copy({ targets: [ { src: 'src/index.html', dest: 'dist/public' }, { src: 'assets/js/*.js', file: 'dist/public/scripts.js' }, { src: 'assets/images/**/*', dest: 'dist/public/images' } ] }) ] }
Debug
Known issues
breakingPlugin requires Rollup 2.x or later
fix
Update Rollup to v2+ or use an older version of the plugin.
affects: <2.0.0
gotchaThe 'file' target property only works for UTF-8 encoded files. Binary files merged into one will produce corrupt output.
fix
Use 'file' only for text files; for binary assets, use 'dest' instead.
affects: >=0.0.0
gotchaWhen using flatten: false, the directory structure from src is preserved in dest. This may cause unintended nested directories.
fix
Set flatten: true (default) to ignore src directory structure.
affects: >=0.0.0
deprecatedThe 'rename' option as a string renames only the last part of the path; for full control use a function.
fix
Provide a function as rename: (name, ext, srcPath) => ...
affects: >=0.0.0
breakingGlobby ^11.1.0 requires Node >=10; older Node versions may fail.
fix
Ensure Node >=14 as specified in engine requirement.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'rollup-plugin-copy-merge'
Package not installed or missing from node_modules.
fix
Run: npm install rollup-plugin-copy-merge --save-dev
TypeError: copy is not a function
Using CommonJS require without .default.
fix
Change to: const copy = require('rollup-plugin-copy-merge').default
Error: ENOENT: no such file or directory, copyfile '...' -> '...'
Source path does not exist or glob matches nothing.
fix
Check src paths and ensure files exist; use absolute paths or adjust relative to project root.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
@types/fs-extraoptionalpeer dependency for TypeScript type definitions
coloretterequiredpeer dependency for coloring console output
fs-extrarequiredpeer dependency for enhanced file system operations
globbyrequiredpeer dependency for glob pattern matching
Agent activity
7 hits · last 30 days
node
6
Resources
rollup-plugin-copy-merge — npm install rollup-plugin-copy-merge · libregistry