{"id":21965,"library":"rollup-plugin-copy-merge","title":"rollup-plugin-copy-merge","description":"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.","status":"active","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/syJSdev/rollup-plugin-copy-merge","tags":["javascript","rollup","rollup-plugin","copy","cp","asset","assets","file","files","typescript"],"install":[{"cmd":"npm install rollup-plugin-copy-merge","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-copy-merge","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-copy-merge","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for TypeScript type definitions","package":"@types/fs-extra","optional":true},{"reason":"peer dependency for coloring console output","package":"colorette","optional":false},{"reason":"peer dependency for enhanced file system operations","package":"fs-extra","optional":false},{"reason":"peer dependency for glob pattern matching","package":"globby","optional":false}],"imports":[{"note":"The package provides a default ESM export. CommonJS require will not work without .default.","wrong":"const copy = require('rollup-plugin-copy-merge')","symbol":"default","correct":"import copy from 'rollup-plugin-copy-merge'"},{"note":"RollupOptions is not exported by this plugin; import from 'rollup'.","wrong":"import { RollupOptions } from 'rollup-plugin-copy-merge'","symbol":"RollupOptions","correct":"import type { RollupOptions } from 'rollup'"},{"note":"TypeScript types are bundled; CopyOptions interface is exported for configuration.","wrong":"","symbol":"CopyOptions","correct":"import type { CopyOptions } from 'rollup-plugin-copy-merge'"}],"quickstart":{"code":"// rollup.config.js\nimport copy from 'rollup-plugin-copy-merge'\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/app.js',\n    format: 'cjs'\n  },\n  plugins: [\n    copy({\n      targets: [\n        { src: 'src/index.html', dest: 'dist/public' },\n        { src: 'assets/js/*.js', file: 'dist/public/scripts.js' },\n        { src: 'assets/images/**/*', dest: 'dist/public/images' }\n      ]\n    })\n  ]\n}","lang":"typescript","description":"Shows basic plugin usage in rollup.config.js, including copying single files, merging globs into a single file, and using glob patterns."},"warnings":[{"fix":"Update Rollup to v2+ or use an older version of the plugin.","message":"Plugin requires Rollup 2.x or later","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Use 'file' only for text files; for binary assets, use 'dest' instead.","message":"The 'file' target property only works for UTF-8 encoded files. Binary files merged into one will produce corrupt output.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set flatten: true (default) to ignore src directory structure.","message":"When using flatten: false, the directory structure from src is preserved in dest. This may cause unintended nested directories.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Provide a function as rename: (name, ext, srcPath) => ...","message":"The 'rename' option as a string renames only the last part of the path; for full control use a function.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Ensure Node >=14 as specified in engine requirement.","message":"Globby ^11.1.0 requires Node >=10; older Node versions may fail.","severity":"breaking","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":"Run: npm install rollup-plugin-copy-merge --save-dev","cause":"Package not installed or missing from node_modules.","error":"Error: Cannot find module 'rollup-plugin-copy-merge'"},{"fix":"Change to: const copy = require('rollup-plugin-copy-merge').default","cause":"Using CommonJS require without .default.","error":"TypeError: copy is not a function"},{"fix":"Check src paths and ensure files exist; use absolute paths or adjust relative to project root.","cause":"Source path does not exist or glob matches nothing.","error":"Error: ENOENT: no such file or directory, copyfile '...' -> '...'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}