staticCopy(options)
ts
staticCopy({
targets: [
{ src: "LICENSE", dest: "meta/LICENSE" },
{
src: "robots.template.txt",
dest: "robots.txt",
transform: (content) => content.toString("utf8").replaceAll("{{HOST}}", "example.com"),
},
],
missing: "warn",
});dest is always relative to Vite outDir; escaping paths are rejected. transform supports regular files only; directories use native recursive copying.
staticCopy Copy
Copies licenses, robots.txt, or static directories after Vite writes output.
Signature
ts
export function staticCopy(options: StaticCopyPluginOptions): Plugin;Example
ts
import { staticCopy } from "fast-vite-plugins";
const plugin = staticCopy({ targets: [{ src: "public/robots.txt", dest: "meta/robots.txt" }] });
export default { plugins: [plugin] };Input
| Input | Type | Required / default | Description |
|---|---|---|---|
options | StaticCopyPluginOptions | Required | Copy targets and missing-source behavior. |
Returns
| Value | Type | Description |
|---|---|---|
plugin | Plugin | Static-copy plugin for Vite plugins. |
