Registry / devops / webpack-concat-files-plugin

webpack-concat-files-plugin

JSON →
library0.5.2jsnpmunverified

Webpack plugin for concatenating and transforming files into bundles. Supports glob patterns, before/after transforms for operations like minification, and Webpack 5 optimization. Current version 0.5.2 (Feb 2021) supports Webpack 4 and 5. Differentiates from alternatives by integrating directly with Webpack's asset pipeline and watch mode. Uses 'bundles' config with src/dest arrays, separation string, and optional transforms. Deprecated old 'source'/'destination' options in favor of 'src'/'dest'.

npm install webpack-concat-files-plugin
INSTALL
IMPORT
SIG · WEBPACK-CONCAT-FIL
W
webpack-concat-files-plugin
devopsjavascriptv0.5.2
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.

default
const WebpackConcatPlugin = require('webpack-concat-files-plugin');
import WebpackConcatPlugin from 'webpack-concat-files-plugin';
Package does not ship ESM; only CommonJS require works. For TypeScript, use require or skip type definitions.
WebpackConcatPlugin
new WebpackConcatPlugin({ bundles: [...] })
new WebpackConcatPlugin({ bundles: { ... } })
bundles must be an array, not a single object. Common mistake.
bundle.src
{ src: './path/**/*.js', dest: './output.js' }
{ source: './path/**/*.js', destination: './output.js' }
source/destination deprecated since 0.5.0, use src/dest.

Basic setup concatenating multiple files with optional transform and configuration options.

const WebpackConcatPlugin = require('webpack-concat-files-plugin'); const path = require('path'); module.exports = { entry: './src/index.js', output: { path: path.resolve(__dirname, 'dist'), filename: 'bundle.js', }, plugins: [ new WebpackConcatPlugin({ bundles: [ { src: ['./src/header.js', './src/footer.js'], dest: './dist/combined.js', transforms: { after: (code) => code.replace(/\s+/g, ' ').trim(), }, encoding: 'utf8', }, ], separator: '\n', allowWatch: true, allowOptimization: false, }), ], };
Debug
Known issues
breakingv0.5.0 deprecated bundle.source and bundle.destination; replaced with bundle.src and bundle.dest
fix
Rename 'source' to 'src' and 'destination' to 'dest' in bundle config.
affects: >=0.5.0
gotchaBefore transform's second parameter may be undefined in v0.5.1 and earlier
fix
Upgrade to v0.5.2 or later.
affects: <0.5.2
breakingArray-valued bundle.src or bundle.source causes error in v0.5.0 and earlier
fix
Upgrade to v0.5.1+ or ensure src is a string.
affects: <0.5.1
gotchabundle.src expects glob string; non-glob paths may not work as expected
fix
Use glob patterns like './src/**/*.js' or an array of glob strings.
affects: all
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'src')
bundles property is missing or not an array
fix
Ensure config object has 'bundles' as an array: new WebpackConcatPlugin({ bundles: [...] }).
Error: bundle.source is deprecated, use bundle.src instead
Using deprecated source property after v0.5.0
fix
Replace 'source' with 'src' in bundle configuration.
ENOENT: no such file or directory, open '...'
Glob pattern does not match any files or path is incorrect
fix
Verify glob pattern and ensure files exist; use path.resolve for absolute paths.
Upgrade
Version history
0.5.2latest on npm
Audit
Dependencies
webpackrequiredpeer dependency required for plugin to function
Agent activity
11 hits · last 30 days
node
10
Resources
webpack-concat-files-plugin — npm install webpack-concat-files-plugin · libregistry