An esbuild plugin that copies files from specified source patterns to a destination directly within the esbuild build process. Version 2.3.1 is the current stable release, with active maintenance as of 2024. It supports glob patterns and optional exclusion filters, allowing developers to copy assets like static files, configs, or HTML alongside bundled JavaScript output. Unlike manual copy steps or post-build scripts, this plugin integrates with esbuild's watch mode to re-copy files on each rebuild. It also offers a `forceCopyOnRebuild` option to force recopy even when sources are unchanged. TypeScript types are included for better IDE support.
npm install esbuild-plugin-copy-watchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Copies files matching 'static/**' to a 'static' directory in the output, and copies config JS files excluding 'private.js', with no force recopy.
Use default import: import copy from 'esbuild-plugin-copy-watch'
Set forceCopyOnRebuild to true if needed; see docs for alternative
Update esbuild to version 0.8.0 or later
Wrap pattern and negation in an array: ['src/**', '!src/private.js']
Run: npm install esbuild-plugin-copy-watch
Use import copy from 'esbuild-plugin-copy-watch' and ensure your project is ESM (type: module in package.json)
Update esbuild: npm install esbuild@latest