{"id":25272,"library":"esbuild-copy-plugin","title":"esbuild-copy-plugin","description":"A plugin for esbuild that copies files or directories from one location to another during the build process. Version 1.0.0 is the current release. It provides a simple API to define copy operations using `from` and `to` paths. Unlike general-purpose tools like `cpy` or `copy-webpack-plugin`, this is tightly integrated with esbuild's plugin system and runs as part of the build lifecycle. The package is lightweight, with no dependencies. It is maintained, but has a low release cadence.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/DasRed/esbuild-plugin-copy","tags":["javascript","esbuild","plugin","copy"],"install":[{"cmd":"npm install esbuild-copy-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-copy-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-copy-plugin","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package exports a single default function that returns an esbuild plugin.","symbol":"default","correct":"import copy from 'esbuild-copy-plugin'"},{"note":"Requiring with destructuring fails because the module exports a default, not named exports.","wrong":"const { copy } = require('esbuild-copy-plugin')","symbol":"default","correct":"const copy = require('esbuild-copy-plugin')"}],"quickstart":{"code":"import esbuild from 'esbuild';\nimport copy from 'esbuild-copy-plugin';\n\nawait esbuild.build({\n    entryPoints: ['./src/index.js'],\n    bundle: true,\n    outfile: './dist/index.js',\n    plugins: [\n        copy({ from: './public', to: '.' }),\n    ],\n});","lang":"javascript","description":"Basic usage: copies all files from ./public to ./dist (the output directory) during the esbuild build."},"warnings":[{"fix":"Use absolute paths or ensure your working directory is the project root.","message":"The `from` path is relative to the current working directory, not the esbuild build's root.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Specify 'to' relative to outdir, e.g., if outdir is './dist', to: '.' places files directly in './dist'.","message":"The `to` path is relative to the output directory (outfile/outdir's parent by default).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"N/A","message":"No known deprecations.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Make sure esbuild build is awaited (since esbuild 0.17+ build returns a promise).","cause":"The copy operation completed after esbuild finished because it's asynchronous but not awaited.","error":"Error: The plugin \"copy\" returned a copy result but the build finished."},{"fix":"Use `import copy from 'esbuild-copy-plugin'` or `const copy = require('esbuild-copy-plugin')`.","cause":"Using `import { copy } from 'esbuild-copy-plugin'` instead of default import.","error":"TypeError: copy is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}