Installations
npm install rollup-plugin-copy
Developer Guide
Typescript
Yes
Module System
CommonJS
Min. Node Version
>=8.3
Node Version
18.16.0
NPM Version
9.5.1
Score
96.7
Supply Chain
98.5
Quality
73.9
Maintenance
100
Vulnerability
98.6
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
vladshcherbin
Download Statistics
Total Downloads
87,296,890
Last Day
3,650
Last Week
3,650
Last Month
1,456,231
Last Year
22,451,051
GitHub Statistics
271 Stars
129 Commits
55 Forks
3 Watching
2 Branches
10 Contributors
Bundle Size
151.68 kB
Minified
46.85 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.5.0
Package Id
rollup-plugin-copy@3.5.0
Unpacked Size
16.19 kB
Size
3.96 kB
File Count
5
NPM Version
9.5.1
Node Version
18.16.0
Publised On
02 Sept 2023
Total Downloads
Cumulative downloads
Total Downloads
87,296,890
Last day
0%
3,650
Compared to previous day
Last week
-98.9%
3,650
Compared to previous week
Last month
-7.6%
1,456,231
Compared to previous month
Last year
-15.7%
22,451,051
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
rollup-plugin-copy
Copy files and folders, with glob support.
Installation
1# yarn 2yarn add rollup-plugin-copy -D 3 4# npm 5npm install rollup-plugin-copy -D
Usage
1// rollup.config.js 2import copy from 'rollup-plugin-copy' 3 4export default { 5 input: 'src/index.js', 6 output: { 7 file: 'dist/app.js', 8 format: 'cjs' 9 }, 10 plugins: [ 11 copy({ 12 targets: [ 13 { src: 'src/index.html', dest: 'dist/public' }, 14 { src: ['assets/fonts/arial.woff', 'assets/fonts/arial.woff2'], dest: 'dist/public/fonts' }, 15 { src: 'assets/images/**/*', dest: 'dist/public/images' } 16 ] 17 }) 18 ] 19}
Configuration
There are some useful options:
targets
Type: Array
| Default: []
Array of targets to copy. A target is an object with properties:
- src (
string
Array
): Path or glob of what to copy - dest (
string
Array
): One or more destinations where to copy - rename (
string
Function
): Change destination file or folder name - transform (
Function
): Modify file contents
Each object should have src and dest properties, rename and transform are optional. globby is used inside, check it for glob pattern examples.
File
1copy({ 2 targets: [{ src: 'src/index.html', dest: 'dist/public' }] 3})
Folder
1copy({ 2 targets: [{ src: 'assets/images', dest: 'dist/public' }] 3})
Glob
1copy({ 2 targets: [{ src: 'assets/*', dest: 'dist/public' }] 3})
Glob: multiple items
1copy({ 2 targets: [{ src: ['src/index.html', 'src/styles.css', 'assets/images'], dest: 'dist/public' }] 3})
Glob: negated patterns
1copy({ 2 targets: [{ src: ['assets/images/**/*', '!**/*.gif'], dest: 'dist/public/images' }] 3})
Multiple targets
1copy({ 2 targets: [ 3 { src: 'src/index.html', dest: 'dist/public' }, 4 { src: 'assets/images/**/*', dest: 'dist/public/images' } 5 ] 6})
Multiple destinations
1copy({ 2 targets: [{ src: 'src/index.html', dest: ['dist/public', 'build/public'] }] 3})
Rename with a string
1copy({ 2 targets: [{ src: 'src/app.html', dest: 'dist/public', rename: 'index.html' }] 3})
Rename with a function
1copy({ 2 targets: [{ 3 src: 'assets/docs/*', 4 dest: 'dist/public/docs', 5 rename: (name, extension, fullPath) => `${name}-v1.${extension}` 6 }] 7})
Transform file contents
1copy({ 2 targets: [{ 3 src: 'src/index.html', 4 dest: 'dist/public', 5 transform: (contents, filename) => contents.toString().replace('__SCRIPT__', 'app.js') 6 }] 7})
verbose
Type: boolean
| Default: false
Output copied items to console.
1copy({ 2 targets: [{ src: 'assets/*', dest: 'dist/public' }], 3 verbose: true 4})
hook
Type: string
| Default: buildEnd
Rollup hook the plugin should use. By default, plugin runs when rollup has finished bundling, before bundle is written to disk.
1copy({ 2 targets: [{ src: 'assets/*', dest: 'dist/public' }], 3 hook: 'writeBundle' 4})
copyOnce
Type: boolean
| Default: false
Copy items once. Useful in watch mode.
1copy({ 2 targets: [{ src: 'assets/*', dest: 'dist/public' }], 3 copyOnce: true 4}) 5
copySync
Type: boolean
| Default: false
Copy items synchronous.
1copy({ 2 targets: [{ src: 'assets/*', dest: 'dist/public' }], 3 copySync: true 4})
flatten
Type: boolean
| Default: true
Remove the directory structure of copied files.
1copy({ 2 targets: [{ src: 'assets/**/*', dest: 'dist/public' }], 3 flatten: false 4})
All other options are passed to packages, used inside:
Original Author
License
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 5/25 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 10 are checked with a SAST tool
Reason
27 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
1.6
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to rollup-plugin-copy
rollup-plugin-copy-assets
Copy additional assets into the output directory of your rollup bundle.
vite-plugin-static-copy
rollup-plugin-copy for vite with dev server support.
@web/rollup-plugin-copy
Rollup plugin which copies asset files while retaining the relative folder structure.
@guanghechen/rollup-plugin-copy
Rollup plugins to copy files and folds (glob supported)