Registry / devops / no-emit-webpack-plugin

no-emit-webpack-plugin

JSON →
library4.0.1jsnpmunverified

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.

npm install no-emit-webpack-plugin
INSTALL
IMPORT
SIG · NO-EMIT-WEBPACK-PL
N
no-emit-webpack-plugin
devopsjavascriptv4.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

NoEmitPlugin
import NoEmitPlugin from 'no-emit-webpack-plugin'
const NoEmitPlugin = require('no-emit-webpack-plugin').default
The package exports a single class via default export. In CommonJS (Node), use require without .default.
default
const NoEmitPlugin = require('no-emit-webpack-plugin')
const { NoEmitPlugin } = require('no-emit-webpack-plugin')
CommonJS users must assign the entire module export; named destructuring will yield undefined.
NoEmitPlugin (type)
import type { NoEmitPlugin } from 'no-emit-webpack-plugin'
import { NoEmitPlugin } from 'no-emit-webpack-plugin'
The class is the default export, so type-only imports require a different syntax (works in TypeScript).

Suppress the 'style.js' output generated from a CSS entry point using MiniCssExtractPlugin.

const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const NoEmitPlugin = require('no-emit-webpack-plugin'); module.exports = { entry: { style: './src/style.css', main: './src/main.js', }, module: { rules: [{ test: /\.css$/iu, use: [MiniCssExtractPlugin.loader, 'css-loader'], }], }, plugins: [ new MiniCssExtractPlugin({ filename: '[name].css' }), new NoEmitPlugin('style.js'), // suppresses the JS stub for style.css ], };
Debug
Known issues
breakingWebpack 5 support requires version 4.x; Webpack 4 users must use version 3.0.0.
fix
Pin to 'no-emit-webpack-plugin@3.0.0' for Webpack 4 projects.
affects: >=4.0.0
breakingPassing an empty array [] will cause the plugin to do nothing (no assets removed).
fix
Ensure array argument has at least one string element.
affects: >=4.0.0
breakingMinimum Node.js version raised to 10.13.0 in v4.0.0.
fix
Upgrade Node.js to >=10.13.0 or use v3.0.0.
affects: >=4.0.0
deprecatedUsing a non-string file name (e.g., number) will throw a validation error since v3.0.0.
fix
Always pass string or array of strings.
affects: >=3.0.0
Errors
Common errors & fixes
Error: NoEmitPlugin is not a constructor
Using destructured import in CommonJS (e.g., const { NoEmitPlugin } = require(...)) when the module exports a single default.
fix
Use const NoEmitPlugin = require('no-emit-webpack-plugin');
TypeError: compilation.hooks is undefined
Using version 4.x with Webpack 4, which does not have the new hooks API.
fix
Downgrade to no-emit-webpack-plugin@3.0.0 for Webpack 4.
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies
webpackoptionalpeer dependency; plugin is a webpack plugin
Agent activity
2 hits · last 30 days
node
2
Resources
no-emit-webpack-plugin — npm install no-emit-webpack-plugin · libregistry