# vite-plugin-copy-smartly

> a hacked version of rollup-plugin-copy to support vite

Latest version **0.2.0** (published 2026-05-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install vite-plugin-copy-smartly
pnpm add vite-plugin-copy-smartly
yarn add vite-plugin-copy-smartly
bun add vite-plugin-copy-smartly
```

## Health

**Score 50/100 (C)** — status: active.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2026-05-28 |
| First published | 2023-09-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | ^20.19.0 \|\| >=22.12.0 |
| Dependencies | 2 |
| Unpacked size | 9.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Huw Roberts |
| Maintainers | wuhnder |
| Keywords | vite, watch, copy, plugin, rollup |

## Links

- npm: https://www.npmjs.com/package/vite-plugin-copy-smartly
- Repository: https://github.com/wuhhh/vite-plugin-copy-smartly
- Homepage: https://github.com/wuhhh/vite-plugin-copy-smartly#readme
- Issues: https://github.com/wuhhh/vite-plugin-copy-smartly/issues
- npm.io page: https://npm.io/package/vite-plugin-copy-smartly

## Dependencies (2)

- [chokidar](https://npm.io/package/chokidar.md) ^3.5.3
- [fs-extra](https://npm.io/package/fs-extra.md) ^10.0.0

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2026-05-28
- 0.1.4 — 2025-05-20
- 0.1.3 — 2025-05-20
- 0.1.2 — 2025-05-20
- 0.1.1-alpha — 2023-09-06
- 0.1.0-alpha — 2023-09-06

## README

# vite-plugin-copy-smartly

This is a not-so-smart hack of the [rollup-copy-smartly](https://github.com/TrickyPi/rollup-copy-smartly) Rollup plugin by TrickyPi. They take all of the credit for this work, I simply changed two hooks to make it work with Vite. This is not battle tested and there may be better ways to achieve this. PRs welcome.

## Features

Smartly copy files if they are changed, created or deleted.

## Getting Started

```console
npm install --save-dev vite-plugin-copy-smartly
```

or

```console
yarn add -D vite-plugin-copy-smartly
```

or

```console
pnpm add -D vite-plugin-copy-smartly
```

## Use

**vite.config.js**

```js
import copy from "vite-plugin-copy-smartly";
export default {
    ...
    plugins: [
       	copy({
		src: path.resolve(__dirname, "src/public/"),
		pattern: /\.(svg|png|jpg|gif|webp|json|lottie)$/,
		dest: path.resolve(__dirname, "web/dist/"),
	}),
    ],
};
```

## Options

| option  | type                | description                                                                          |
| ------- | ------------------- | ------------------------------------------------------------------------------------ |
| src     | string              | Path to dir which will be watching, it could be absolute path or relative path       |
| pattern | RegExp or RegExp[ ] | Filter specific files                                                                |
| dest    | string or string[ ] | Paths to dir which are output directorys, it could be absolute path or relative path |

---
_Source: https://npm.io/package/vite-plugin-copy-smartly · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
