{"id":20729,"library":"webpack-concat-plugin","title":"webpack-concat-plugin","description":"A webpack plugin to concatenate JavaScript files (npm modules, glob patterns, or plain paths) and optionally inject the resulting script into HTML via html-webpack-plugin. Version 3.0.0 requires webpack ^4.0.1. Notable differentiator: allows concat and injection without webpack's JSONP wrapper. Works exclusively with CommonJS (require); no ESM support. Low maintenance cadence, last release in 2019.","status":"maintenance","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/hxlniada/webpack-concat-plugin","tags":["javascript"],"install":[{"cmd":"npm install webpack-concat-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-concat-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-concat-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for plugin to operate","package":"webpack","optional":true},{"reason":"used internally for source map and file concatenation","package":"webpack-sources","optional":false},{"reason":"used to resolve glob patterns in filesToConcat","package":"globby","optional":false},{"reason":"optional minification, only used if uglify option is set","package":"uglify-js","optional":true}],"imports":[{"note":"Package uses CommonJS and does not export an ESM default. Using import will fail unless you use a bundler that supports default interop, but the package is not typed for ESM.","wrong":"import ConcatPlugin from 'webpack-concat-plugin';","symbol":"ConcatPlugin","correct":"const ConcatPlugin = require('webpack-concat-plugin');"},{"note":"There is no named export 'ConcatPlugin'; the entire module exports the class directly.","wrong":"import { ConcatPlugin } from 'webpack-concat-plugin';","symbol":"default export","correct":"const ConcatPlugin = require('webpack-concat-plugin');"},{"note":"In TypeScript with esModuleInterop: false, use import = require. The package has no type definitions.","wrong":"import ConcatPlugin from 'webpack-concat-plugin';","symbol":"TypeScript usage","correct":"import ConcatPlugin = require('webpack-concat-plugin');"}],"quickstart":{"code":"const ConcatPlugin = require('webpack-concat-plugin');\n\nmodule.exports = {\n  entry: './index.js',\n  output: {\n    path: 'dist',\n    filename: 'bundle.js'\n  },\n  plugins: [\n    new ConcatPlugin({\n      uglify: false,\n      sourceMap: false,\n      name: 'result',\n      fileName: '[name].[hash:8].js',\n      filesToConcat: ['jquery', './src/lib/**', './dep/dep.js']\n    })\n  ]\n};","lang":"javascript","description":"Shows basic usage with webpack 4: configure ConcatPlugin to concatenate jQuery, glob files, and a specific dep into a single hashed file."},"warnings":[{"fix":"If using webpack 5, consider an alternative like webpack-manifest-plugin or manual concat. For webpack 3, use version 2.x.","message":"Version 3.0.0 requires webpack ^4.0.1. It will not work with webpack 5 or webpack 3.","severity":"breaking","affected_versions":"3.0.0"},{"fix":"Override engine-strict or use a newer alternative. The package may still work but is untested.","message":"Node engine restriction: >= 4.8 < 5.0.0 || >= 5.10. This is outdated and may cause issues on modern Node versions (e.g., Node >=12).","severity":"deprecated","affected_versions":"3.0.0"},{"fix":"Use require() or transpile your config with a bundler that converts ESM to CJS.","message":"The plugin only supports CommonJS require; attempting ES import will fail in pure ESM environments (e.g., Node with 'type': 'module').","severity":"gotcha","affected_versions":"all"},{"fix":"Check compatibility: if inject fails, set injectType to 'none' and manually reference the generated file.","message":"html-webpack-plugin injection may not work with html-webpack-plugin v4+ due to API changes.","severity":"breaking","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install webpack-concat-plugin@3.0.0 --save-dev' in your project root.","cause":"Package not installed or installed in wrong directory.","error":"Cannot find module 'webpack-concat-plugin'"},{"fix":"Use 'const ConcatPlugin = require('webpack-concat-plugin');'","cause":"Using named import instead of default require.","error":"TypeError: ConcatPlugin is not a constructor"},{"fix":"Add 'filesToConcat: [\"some/path.js\"]' to the plugin options.","cause":"Missing required filesToConcat configuration.","error":"Error: The 'filesToConcat' option is required"},{"fix":"Downgrade webpack to 4.x or use a different concat plugin (e.g., webpack-concat-plugin does not support webpack 5).","cause":"The plugin is designed for webpack 4.x only.","error":"Error: webpack version 5.x is not supported"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}