A Rollup plugin to copy additional assets to the build directory, version 0.4.0. Unlike typical copy plugins, it does not copy by default but emits files into the Rollup bundle, making them accessible to other plugins (e.g., rollup-plugin-zip). Actual copying is handled by Rollup itself. It supports glob patterns, source-destination pairs, and an optional outputDirectory for direct disk writes. Requires Rollup >=3.20.0. Minimalistic, ESM-only, with TypeScript support.
npm install rollup-plugin-copy2Verified import paths — ran on the pinned version, not inferred.
Rollup configuration using copy plugin with glob, source-destination pair, and extra output directory.
Set outputDirectory to a path if you need files on disk, or use another plugin like rollup-plugin-copy (note different package).
Use single string glob for multiple files; for renaming, use [exactPath, destPath].
Use import or dynamic import() in an ESM context. Set type: 'module' in package.json or use .mjs extension.
Either set outputDirectory to copy to disk, or add another plugin that consumes emitted assets (e.g., rollup-plugin-zip).
Change import copy from 'rollup-plugin-copy2' to import { copy } from 'rollup-plugin-copy2'.Upgrade rollup to ^3.20.0 or later: npm install rollup@latest --save-dev.
Use named import: import { copy } from 'rollup-plugin-copy2'.