{"id":21972,"library":"rollup-plugin-cpy","title":"rollup-plugin-cpy","description":"Rollup plugin for copying files and folders using the cpy library. Version 2.0.1 is the latest stable release, last updated in 2019. Compatible with Rollup >= 1.0. Provides a simple configuration interface with glob support and verbose logging. Differentiated from other copy plugins (like rollup-plugin-copy) by leveraging the well-maintained cpy package. No active development.","status":"active","version":"2.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/paulmelnikow/rollup-plugin-cpy","tags":["javascript","rollup","rollup-plugin","rollup copy","rollup plugin copy"],"install":[{"cmd":"npm install rollup-plugin-cpy","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-cpy","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-cpy","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core library used for file copying","package":"cpy","optional":false}],"imports":[{"note":"Default export; ESM-only. CommonJS require must use .default.","wrong":"const { default: copy } = require('rollup-plugin-cpy')","symbol":"default","correct":"import copy from 'rollup-plugin-cpy'"},{"note":"Named import does not exist; use default import.","wrong":"import { copy } from 'rollup-plugin-cpy'","symbol":"copy","correct":"import copy from 'rollup-plugin-cpy'"},{"note":"TypeScript types not exported; manually type the config as { files: string | string[], dest: string, options?: { verbose?: boolean, cwd?: string, ... } }","wrong":"import { Config } from 'rollup-plugin-cpy'","symbol":"ConfigArray","correct":"// Config is an array of objects or a single object\n// No TypeScript types are provided in this version.\n// Use JSDoc or infer from usage."}],"quickstart":{"code":"// Install: npm i -D rollup-plugin-cpy\n// rollup.config.js\nimport copy from 'rollup-plugin-cpy';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'cjs'\n  },\n  plugins: [\n    copy({\n      files: ['src/static/**/*', '!src/static/exclude.txt'],\n      dest: 'dist/static',\n      options: { verbose: true }\n    })\n  ]\n};","lang":"javascript","description":"Copies all files from src/static to dist/static, excluding exclude.txt."},"warnings":[{"fix":"Ensure dest directory does not overlap with output dir, or use copy as last plugin.","message":"Files are copied after the bundle is written, so they may overwrite output files if dest overlaps.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Make sure Rollup is configured to handle CJS dependencies (e.g., with @rollup/plugin-commonjs).","message":"The cpy library uses CJS; rollup-plugin-cpy is ESM only, requiring Rollup to handle dependencies.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Pin cpy to v8 in your package.json if issues arise.","message":"The cpy package v9+ changed API; this plugin uses cpy v8 internally, causing potential incompatibility if cpy is updated globally.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Upgrade Node to >=8 and Rollup to >=1.","message":"Version 2.0.0 dropped support for Node.js < 8 and Rollup < 1.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use path.posix.join or manually convert backslashes.","message":"Glob patterns in files should use forward slashes (/) even on Windows.","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":"Run 'npm install cpy' or add cpy to your devDependencies.","cause":"cpy is a peer dependency not installed automatically.","error":"Error: Cannot find module 'cpy'"},{"fix":"Use: const copy = require('rollup-plugin-cpy').default;","cause":"CommonJS require without accessing .default","error":"TypeError: (0 , _rollupPluginCpy.default) is not a function"},{"fix":"Use require() or transpile with Babel/TypeScript.","cause":"Using ES module syntax without transpilation in Node < 9 or without type: 'module'.","error":"Error: Unexpected token: punc (.)"},{"fix":"Upgrade Node to >=12 or remove exports from package.json manually.","cause":"Old Node versions may not resolve package exports properly.","error":"ERR_PACKAGE_PATH_NOT_EXPORTED: Package subpath './package.json' is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}