{"id":20201,"library":"merge-files-webpack-plugin","title":"Merge Files Webpack Plugin","description":"This webpack plugin merges multiple files output by extract-text-webpack-plugin (e.g., per-entry CSS files) into a single file. Version 1.1.2 is the latest; no new releases and no activity on GitHub since 2018. It requires webpack 2+ and extract-text-webpack-plugin 2+. Useful for combining CSS from multiple entries, but limited to legacy webpack setups. Alternative: mini-css-extract-plugin (webpack 4+).","status":"maintenance","version":"1.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/jtefera/merge-files-webpack","tags":["javascript"],"install":[{"cmd":"npm install merge-files-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add merge-files-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add merge-files-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required as the source plugin that extracts text files per entry.","package":"extract-text-webpack-plugin","optional":false}],"imports":[{"note":"CommonJS usage typical for webpack configs; no ESM or TypeScript types available.","symbol":"MergeFilesPlugin","correct":"const MergeFilesPlugin = require('merge-files-webpack-plugin');"},{"note":"This package uses a default export, so named import will fail.","wrong":"import { MergeFilesPlugin } from 'merge-files-webpack-plugin';","symbol":"MergeFilesPlugin","correct":"import MergeFilesPlugin from 'merge-files-webpack-plugin';"}],"quickstart":{"code":"const path = require('path');\nconst MergeFilesPlugin = require('merge-files-webpack-plugin');\nconst ExtractTextPlugin = require('extract-text-webpack-plugin');\n\nmodule.exports = {\n  entry: {\n    a: './src/entryA.js',\n    b: './src/entryB.js'\n  },\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: '[name].js'\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.css$/,\n        use: ExtractTextPlugin.extract({ use: 'css-loader' })\n      }\n    ]\n  },\n  plugins: [\n    new ExtractTextPlugin({ filename: '[name].style.css' }),\n    new MergeFilesPlugin({\n      filename: 'combined.css',\n      test: /\\.css$/,\n      deleteSourceFiles: true\n    })\n  ]\n};","lang":"javascript","description":"Merges per-entry CSS files from extract-text-webpack-plugin into one combined.css, deleting intermediate files."},"warnings":[{"fix":"Migrate to mini-css-extract-plugin and remove merge-files-webpack-plugin (mini-css-extract-plugin supports merging via configuration).","message":"extract-text-webpack-plugin is deprecated in webpack 4+; use mini-css-extract-plugin instead.","severity":"deprecated","affected_versions":">=4.0"},{"fix":"Use a static string like 'css/bundle.css' instead of '[name].bundle.css'.","message":"The filename option in MergeFilesPlugin must not include [name] or other webpack placeholders; it is the final output filename.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Always provide an explicit test (RegExp or string) that matches only the files you intend to merge.","message":"If test option is omitted, it defaults to the filename value. This can cause incorrect files to be merged if filename is not specific enough.","severity":"gotcha","affected_versions":">=1.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 merge-files-webpack-plugin --save-dev (correct name).","cause":"Package not installed or mistyped as 'merge-text-webpack-plugin' (see README error).","error":"Error: Cannot find module 'merge-files-webpack-plugin'"},{"fix":"Use: const MergeFilesPlugin = require('merge-files-webpack-plugin');","cause":"Using named import instead of default import in a CommonJS context.","error":"TypeError: MergeFilesPlugin is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}