{"id":20727,"library":"webpack-concat-files-plugin","title":"webpack-concat-files-plugin","description":"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'.","status":"maintenance","version":"0.5.2","language":"javascript","source_language":"en","source_url":"https://github.com/damorej-at-theinstitutes/webpack-concat-files-plugin","tags":["javascript","webpack","plugin","concat","concatenation","files","transform"],"install":[{"cmd":"npm install webpack-concat-files-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-concat-files-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-concat-files-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for plugin to function","package":"webpack","optional":false}],"imports":[{"note":"Package does not ship ESM; only CommonJS require works. For TypeScript, use require or skip type definitions.","wrong":"import WebpackConcatPlugin from 'webpack-concat-files-plugin';","symbol":"default","correct":"const WebpackConcatPlugin = require('webpack-concat-files-plugin');"},{"note":"bundles must be an array, not a single object. Common mistake.","wrong":"new WebpackConcatPlugin({ bundles: { ... } })","symbol":"WebpackConcatPlugin","correct":"new WebpackConcatPlugin({ bundles: [...] })"},{"note":"source/destination deprecated since 0.5.0, use src/dest.","wrong":"{ source: './path/**/*.js', destination: './output.js' }","symbol":"bundle.src","correct":"{ src: './path/**/*.js', dest: './output.js' }"}],"quickstart":{"code":"const WebpackConcatPlugin = require('webpack-concat-files-plugin');\nconst path = require('path');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  plugins: [\n    new WebpackConcatPlugin({\n      bundles: [\n        {\n          src: ['./src/header.js', './src/footer.js'],\n          dest: './dist/combined.js',\n          transforms: {\n            after: (code) => code.replace(/\\s+/g, ' ').trim(),\n          },\n          encoding: 'utf8',\n        },\n      ],\n      separator: '\\n',\n      allowWatch: true,\n      allowOptimization: false,\n    }),\n  ],\n};","lang":"javascript","description":"Basic setup concatenating multiple files with optional transform and configuration options."},"warnings":[{"fix":"Rename 'source' to 'src' and 'destination' to 'dest' in bundle config.","message":"v0.5.0 deprecated bundle.source and bundle.destination; replaced with bundle.src and bundle.dest","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Upgrade to v0.5.2 or later.","message":"Before transform's second parameter may be undefined in v0.5.1 and earlier","severity":"gotcha","affected_versions":"<0.5.2"},{"fix":"Upgrade to v0.5.1+ or ensure src is a string.","message":"Array-valued bundle.src or bundle.source causes error in v0.5.0 and earlier","severity":"breaking","affected_versions":"<0.5.1"},{"fix":"Use glob patterns like './src/**/*.js' or an array of glob strings.","message":"bundle.src expects glob string; non-glob paths may not work as expected","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure config object has 'bundles' as an array: new WebpackConcatPlugin({ bundles: [...] }).","cause":"bundles property is missing or not an array","error":"TypeError: Cannot read properties of undefined (reading 'src')"},{"fix":"Replace 'source' with 'src' in bundle configuration.","cause":"Using deprecated source property after v0.5.0","error":"Error: bundle.source is deprecated, use bundle.src instead"},{"fix":"Verify glob pattern and ensure files exist; use path.resolve for absolute paths.","cause":"Glob pattern does not match any files or path is incorrect","error":"ENOENT: no such file or directory, open '...'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}