webpack EmitAllPlugin

raw JSON →
2.0.1 verified Sat Apr 25 auth: no javascript maintenance

Webpack plugin that emits all files in the dependency tree as separate files without bundling, allowing use of webpack loaders/plugins for non-bundling tasks. Current version 2.0.1 (unreleased, API usable but unstable, no pre-release). Peer dependency on webpack >=4. Differentiators: eliminates bundling step, useful for processing assets individually while leveraging webpack's loader pipeline. Last updated 2018, no recent maintenance.

error TypeError: EmitAllPlugin is not a constructor
cause Importing the plugin incorrectly as a default export or without 'new'.
fix
Use 'new EmitAllPlugin({...})' after proper require: const EmitAllPlugin = require('webpack-emit-all-plugin');
error Error: Cannot find module 'webpack-emit-all-plugin'
cause Package not installed or in devDependencies.
fix
Run 'npm install -D webpack-emit-all-plugin' to install as dev dependency.
error Output files not emitted to specified path
cause The 'path' option may be relative or missing; defaults to webpack output.path.
fix
Set absolute path using path.resolve(__dirname, 'custom-output') in plugin options.
breaking Plugin may not work with webpack 5 due to internal API changes.
fix Use webpack 4 or test compatibility; consider alternatives like CopyWebpackPlugin.
deprecated Package has not been updated since 2018; no support for webpack 5 or newer features.
fix Migrate to actively maintained plugin like copy-webpack-plugin or assets-webpack-plugin.
gotcha All files in dependency tree are emitted, including node_modules unless ignored.
fix Always provide an ignorePattern option to exclude node_modules to avoid large output.
breaking Output path must be absolute or relative to output.path; relative paths may cause unexpected results.
fix Use path.resolve or path.join with __dirname to specify absolute output path.
npm install webpack-emit-all-plugin
yarn add webpack-emit-all-plugin
pnpm add webpack-emit-all-plugin

Configures webpack with EmitAllPlugin to emit all processed files individually without bundling, applying babel-loader.

const path = require('path');
const EmitAllPlugin = require('webpack-emit-all-plugin');

module.exports = {
  entry: './src/index.js',
  output: { path: path.resolve(__dirname, 'dist') },
  module: {
    rules: [
      { test: /\.js$/, use: 'babel-loader' }
    ]
  },
  plugins: [
    new EmitAllPlugin({
      ignorePattern: /node_modules/,
      path: path.join(__dirname, 'unbundled-out')
    })
  ]
};