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.
npm install --save-dev @sprout2000/esbuild-copy-pluginYou will need to have Node.js >=16.7 installed.
import { build } from "esbuild";
import { copyPlugin } from "@sprout2000/esbuild-copy-plugin";
build({
plugins: [
copyPlugin({
src: "./assets/icon.png",
dest: "./dist/logo.png",
}),
],
});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.
# 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