{"id":19419,"library":"copy-webpack","title":"copy-webpack","description":"A simplified alternative to copy-webpack-plugin for copying files and directories during webpack builds. Current stable version is 6.0.0, released with node >=24 and webpack ^5.105.0 peer dependencies. Key differentiators: vastly simplified API (single string for a glob pattern, no nested `patterns` array), minimal configuration, and ESM-only exports. Replaces the verbose copy-webpack-plugin with a concise one-liner for common use cases, while still supporting advanced options via an array of objects. Active development under the best-shot organization.","status":"active","version":"6.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/best-shot/copy-webpack","tags":["javascript","copy","glob","plugin","webpack"],"install":[{"cmd":"npm install copy-webpack","lang":"bash","label":"npm"},{"cmd":"yarn add copy-webpack","lang":"bash","label":"yarn"},{"cmd":"pnpm add copy-webpack","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required as a peer dependency for plugin integration","package":"webpack","optional":false}],"imports":[{"note":"Named export only; default import does not work.","wrong":"import CopyWebpack from 'copy-webpack'","symbol":"CopyWebpack","correct":"import { CopyWebpack } from 'copy-webpack'"},{"note":"CommonJS require must destructure the named export, as the package is ESM-first.","wrong":"const CopyWebpack = require('copy-webpack')","symbol":"CopyWebpack (via require in CJS)","correct":"const { CopyWebpack } = require('copy-webpack')"},{"note":"If only the type is needed, use `import type` to avoid runtime issues.","wrong":"import { CopyWebpack } from 'copy-webpack'","symbol":"TypeScript type (if any)","correct":"import type { CopyWebpack } from 'copy-webpack'"}],"quickstart":{"code":"// webpack.config.mjs\nimport { CopyWebpack } from 'copy-webpack';\n\nexport default {\n  plugins: [\n    new CopyWebpack('static')\n  ]\n};","lang":"javascript","description":"Shows minimal usage: copy all files from 'static' directory into the webpack output."},"warnings":[{"fix":"Upgrade Node.js to >=24 and pnpm to >=10 (or use an alternative package).","message":"Version 6.0.0 drops support for Node versions below 24 and pnpm <10.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Use the simplified `new CopyWebpack(from)` or `new CopyWebpack([...])` API.","message":"The original copy-webpack-plugin pattern with nested `patterns` array is deprecated.","severity":"deprecated","affected_versions":"*"},{"fix":"Use dynamic import: `const { CopyWebpack } = await import('copy-webpack')`.","message":"Package is ESM-only; CommonJS require with `require('copy-webpack')` will fail.","severity":"gotcha","affected_versions":">=6.0.0"},{"fix":"Test with a sample file to ensure the glob pattern matches expected files.","message":"Plugin does not validate options at instantiation time; misconfigurations may cause silent failures.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Correct import: import { CopyWebpack } from 'copy-webpack'","cause":"Importing default instead of named export","error":"TypeError: CopyWebpack is not a constructor"},{"fix":"Run 'npm install copy-webpack webpack --save-dev'","cause":"Package not installed or peer dependency webpack missing","error":"Module not found: Error: Can't resolve 'copy-webpack'"},{"fix":"Only import from 'copy-webpack' directly; no subpath imports are supported.","cause":"Trying to import from subpath that is not exported","error":"ERR_PACKAGE_PATH_NOT_EXPORTED: Package subpath './package.json' is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}