@sprout2000/esbuild-copy-plugin
v1.1.16
Published
An esbuild plugin to efficiently copy static files from a source directory to a destination directory
Downloads
7,619
Readme
@sprout2000/esbuild-copy-plugin
An esbuild plugin to efficiently copy static files from a source directory to a destination directory.
* This plugin is a typed and fully tested version of @nickjj's esbuild-copy-static-files.
Installation
npm install --save-dev @sprout2000/esbuild-copy-plugin
You will need to have Node.js >=16.7
installed.
Usage
import { build } from "esbuild";
import { copyPlugin } from "@sprout2000/esbuild-copy-plugin";
build({
plugins: [
copyPlugin({
src: "./assets/icon.png",
dest: "./dist/logo.png",
}),
],
});
API
interface CopyPluginOptions extends fs.CopySyncOptions {
src?: string;
dest?: string;
}
| option | default |
| :------------------------------------ | :---------- |
| src?
: string | "assets"
|
| dest?
: string | "dist"
|
| dereference?
: boolean | false
|
| errorOnExist?
: boolean | false
|
| filter?
: (src
, dest
) => boolean | undefined
|
| force?
: boolean | false
|
| preserveTimestamps?
: boolean | false
|
| recursive?
: boolean | true
|
| verbatimSymlinks?
: boolean | false
|
See fs.CopySyncOptions in Node.js LTS for more details.
Unit test
# clone this repo, and install devDependencies...
git clone https://github.com/sprout2000/esbuild-copy-plugin.git
cd esbuild-copy-plugin
npm install
# run the test
npm test