{"id":25997,"library":"no-emit-webpack-plugin","title":"No Emit Webpack Plugin","description":"A webpack plugin that prevents specified asset bundles from being emitted by the compiler. Version 4.0.1 supports webpack 5 and Node >= 10.13.0. Key differentiator: it removes output files (e.g., JavaScript stubs generated from CSS entry points) without affecting the compilation process. The plugin accepts a string or array of asset names to block. It is commonly used with MiniCssExtractPlugin to suppress unwanted JS output. The project has a slow release cadence (last release 2021). Webpack 4 users must pin to version 3.0.0.","status":"active","version":"4.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/xipasduarte/no-emit-webpack-plugin","tags":["javascript","webpack","plugin"],"install":[{"cmd":"npm install no-emit-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add no-emit-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add no-emit-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; plugin is a webpack plugin","package":"webpack","optional":true}],"imports":[{"note":"The package exports a single class via default export. In CommonJS (Node), use require without .default.","wrong":"const NoEmitPlugin = require('no-emit-webpack-plugin').default","symbol":"NoEmitPlugin","correct":"import NoEmitPlugin from 'no-emit-webpack-plugin'"},{"note":"CommonJS users must assign the entire module export; named destructuring will yield undefined.","wrong":"const { NoEmitPlugin } = require('no-emit-webpack-plugin')","symbol":"default","correct":"const NoEmitPlugin = require('no-emit-webpack-plugin')"},{"note":"The class is the default export, so type-only imports require a different syntax (works in TypeScript).","wrong":"import { NoEmitPlugin } from 'no-emit-webpack-plugin'","symbol":"NoEmitPlugin (type)","correct":"import type { NoEmitPlugin } from 'no-emit-webpack-plugin'"}],"quickstart":{"code":"const MiniCssExtractPlugin = require('mini-css-extract-plugin');\nconst NoEmitPlugin = require('no-emit-webpack-plugin');\n\nmodule.exports = {\n  entry: {\n    style: './src/style.css',\n    main: './src/main.js',\n  },\n  module: {\n    rules: [{\n      test: /\\.css$/iu,\n      use: [MiniCssExtractPlugin.loader, 'css-loader'],\n    }],\n  },\n  plugins: [\n    new MiniCssExtractPlugin({ filename: '[name].css' }),\n    new NoEmitPlugin('style.js'),  // suppresses the JS stub for style.css\n  ],\n};","lang":"javascript","description":"Suppress the 'style.js' output generated from a CSS entry point using MiniCssExtractPlugin."},"warnings":[{"fix":"Pin to 'no-emit-webpack-plugin@3.0.0' for Webpack 4 projects.","message":"Webpack 5 support requires version 4.x; Webpack 4 users must use version 3.0.0.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Ensure array argument has at least one string element.","message":"Passing an empty array [] will cause the plugin to do nothing (no assets removed).","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Upgrade Node.js to >=10.13.0 or use v3.0.0.","message":"Minimum Node.js version raised to 10.13.0 in v4.0.0.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Always pass string or array of strings.","message":"Using a non-string file name (e.g., number) will throw a validation error since v3.0.0.","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use const NoEmitPlugin = require('no-emit-webpack-plugin');","cause":"Using destructured import in CommonJS (e.g., const { NoEmitPlugin } = require(...)) when the module exports a single default.","error":"Error: NoEmitPlugin is not a constructor"},{"fix":"Downgrade to no-emit-webpack-plugin@3.0.0 for Webpack 4.","cause":"Using version 4.x with Webpack 4, which does not have the new hooks API.","error":"TypeError: compilation.hooks is undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}