LinbuduLab / esbuild-plugins

ESBuild plugins by @LinbuduLab
MIT License
113 stars 18 forks source link

Feature Request: Add 'once' to the esbuild-plugin-copy #67

Closed jrmyio closed 2 years ago

jrmyio commented 2 years ago

Currently the copy plugin runs on every build (during watch). However, in most situations its just fine to only do the copy on the first cycle to prevent unnecessary resources and disk writing being done on each code change.

I suggest expanding the options to:

export interface Options {
  // assets pair to copy
  assets: MaybeArray<AssetPair>;
  // start copy on onStart hooks instead of onEnd
  // default: false
  copyOnStart: boolean;
  // verbose logging
  // default: true
  verbose: boolean;
  // extra globby options for paths matching, will be passed to globby directly
  globbyOptions: GlobbyOptions;
  // only run the copy once
  // default: false
  once: boolean;
}
linbudu599 commented 2 years ago

This is supported in latest version 1.0.1 now, please refers to esbuild-plugin-copy#configuration