{"id":21963,"library":"rollup-plugin-copy-glob","title":"rollup-plugin-copy-glob","description":"Rollup plugin that copies files and folders during build with glob pattern support and optional renaming. Current stable version is 0.4.1, released with infrequent updates. It is a lightweight alternative to rollup-plugin-copy, offering glob patterns and rename support out of the box, with minimal configuration. It supports Node >=12 and integrates with Rollup's watch mode for file copying on rebuild.","status":"active","version":"0.4.1","language":"javascript","source_language":"en","source_url":"https://github.com/zont/rollup-plugin-copy-glob","tags":["javascript","rollup","plugin","copy","cp","cpy","folder","file","files"],"install":[{"cmd":"npm install rollup-plugin-copy-glob","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-copy-glob","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-copy-glob","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export; CommonJS require() may work but ESM import is recommended for Rollup plugins.","wrong":"const copy = require('rollup-plugin-copy-glob')","symbol":"copy","correct":"import copy from 'rollup-plugin-copy-glob'"},{"note":"TypeScript users can import types for options; available since 0.4.0.","wrong":"","symbol":"CopyOptions","correct":"import type { CopyOptions } from 'rollup-plugin-copy-glob'"},{"note":"Type for each copy target object specifying files, dest, rename.","wrong":"","symbol":"CopyTarget","correct":"import type { CopyTarget } from 'rollup-plugin-copy-glob'"}],"quickstart":{"code":"import copy from 'rollup-plugin-copy-glob';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'iife',\n    name: 'app'\n  },\n  plugins: [\n    copy([\n      { files: 'src/*.{html,css}', dest: 'dist' },\n      { files: 'src/config.template', dest: 'dist', rename: 'config.json' },\n      { files: 'dev/images/**/*.*', dest: 'dist/images' }\n    ], { verbose: true, watch: true })\n  ]\n};","lang":"javascript","description":"Shows basic setup: copy HTML/CSS files with glob, rename a config file, and copy images recursively with verbose logging and watch mode."},"warnings":[{"fix":"Use a separate cleanup plugin like rollup-plugin-delete or manually clean dist before build.","message":"The plugin only copies files at build start or during watch mode; it does not clean the destination before copying, so outdated files may remain.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Remove the 'watch' option; rely on Rollup's --watch flag.","message":"Option 'watch' is deprecated; use Rollup's built-in watch mode instead.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Update your plugin config to use array of objects with 'files' and 'dest' properties.","message":"In version 0.1.0, the API changed from copy(files, dest) to copy([...], options).","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Create the destination directory manually or use a separate mkdirp step.","message":"When using rename, ensure the destination directory exists; the plugin does not create nested directories automatically.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `import copy from 'rollup-plugin-copy-glob'` (default import).","cause":"Importing the plugin incorrectly (e.g., using named import instead of default).","error":"TypeError: copy is not a function"},{"fix":"Verify the path and pattern; check if files exist relative to project root.","cause":"Glob pattern does not match any existing files.","error":"Error: No files matched with pattern: src/**/*.txt"},{"fix":"Create the destination directory before running Rollup, or use a plugin that auto-creates directories.","cause":"The destination directory does not exist.","error":"Error: ENOENT: no such file or directory, copyfile 'source' -> 'dest'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}