Registry / devops / copy-webpack

copy-webpack

JSON →
library6.0.0jsnpmunverified

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.

npm install copy-webpack
INSTALL
IMPORT
SIG · COPY-WEBPACK
C
copy-webpack
devopsjavascriptv6.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CopyWebpack
import { CopyWebpack } from 'copy-webpack'
import CopyWebpack from 'copy-webpack'
Named export only; default import does not work.
CopyWebpack (via require in CJS)
const { CopyWebpack } = require('copy-webpack')
const CopyWebpack = require('copy-webpack')
CommonJS require must destructure the named export, as the package is ESM-first.
TypeScript type (if any)
import type { CopyWebpack } from 'copy-webpack'
import { CopyWebpack } from 'copy-webpack'
If only the type is needed, use `import type` to avoid runtime issues.

Shows minimal usage: copy all files from 'static' directory into the webpack output.

// webpack.config.mjs import { CopyWebpack } from 'copy-webpack'; export default { plugins: [ new CopyWebpack('static') ] };
Debug
Known issues
breakingVersion 6.0.0 drops support for Node versions below 24 and pnpm <10.
fix
Upgrade Node.js to >=24 and pnpm to >=10 (or use an alternative package).
affects: >=6.0.0
deprecatedThe original copy-webpack-plugin pattern with nested `patterns` array is deprecated.
fix
Use the simplified `new CopyWebpack(from)` or `new CopyWebpack([...])` API.
affects: *
gotchaPackage is ESM-only; CommonJS require with `require('copy-webpack')` will fail.
fix
Use dynamic import: `const { CopyWebpack } = await import('copy-webpack')`.
affects: >=6.0.0
gotchaPlugin does not validate options at instantiation time; misconfigurations may cause silent failures.
fix
Test with a sample file to ensure the glob pattern matches expected files.
affects: *
Errors
Common errors & fixes
TypeError: CopyWebpack is not a constructor
Importing default instead of named export
fix
Correct import: import { CopyWebpack } from 'copy-webpack'
Module not found: Error: Can't resolve 'copy-webpack'
Package not installed or peer dependency webpack missing
fix
Run 'npm install copy-webpack webpack --save-dev'
ERR_PACKAGE_PATH_NOT_EXPORTED: Package subpath './package.json' is not defined
Trying to import from subpath that is not exported
fix
Only import from 'copy-webpack' directly; no subpath imports are supported.
Upgrade
Version history
6.0.0latest on npm
Audit
Dependencies
webpackrequiredRequired as a peer dependency for plugin integration
Agent activity
2 hits · last 30 days
node
2
Resources
copy-webpack — npm install copy-webpack · libregistry