Registry / devops / webpack-null-plugin

webpack-null-plugin

JSON →
library0.0.2jsnpmunverified

A tiny npm package (v0.0.2) that provides a no-op Webpack plugin using the null object pattern. It is intended to simplify Webpack configurations that conditionally include plugins by allowing a placeholder that does nothing. The package has no dependencies and has seen no updates since 2016. It is a simple alternative to inline conditional logic in the plugins array. Not actively developed.

npm install webpack-null-plugin
INSTALL
IMPORT
SIG · WEBPACK-NULL-PLUGI
W
webpack-null-plugin
devopsjavascriptv0.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default
import NullPlugin from 'webpack-null-plugin'
const NullPlugin = require('webpack-null-plugin')
The package exports a single class via default export. There is no named export.
NullPlugin
import NullPlugin from 'webpack-null-plugin'
const { NullPlugin } = require('webpack-null-plugin')
Do not destructure require; the package does not export a named NullPlugin.
WebpackPluginInstance
import type { WebpackPluginInstance } from 'webpack'
When using TypeScript, you may want to type the plugin array. The import for the type comes from 'webpack', not this package.

Demonstrates conditionally including a real plugin or the NullPlugin in a webpack configuration.

const NullPlugin = require('webpack-null-plugin'); const shouldUsePlugin = process.env.USE_SOMETHING === 'true'; const webpack = require('webpack'); const compiler = webpack({ // ... other config plugins: [ shouldUsePlugin ? new SomeRealPlugin() : new NullPlugin(), ], }); compiler.run((err, stats) => { if (err) { console.error(err); return; } console.log(stats.toString({ colors: true })); });
Debug
Known issues
deprecatedPackage is deprecated: The null object pattern is unnecessary; simply conditionally include plugins in an array.
fix
Use inline conditional logic in the plugins array: plugins: [ condition && new Plugin() ].filter(Boolean)
affects: >=0.0.1
gotchaMust be instantiated with 'new' before passing to webpack
fix
Always use 'new NullPlugin()' in the plugins array.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: Class constructor NullPlugin cannot be invoked without 'new'
Omitting 'new' when using NullPlugin (e.g., calling NullPlugin() instead of new NullPlugin())
fix
Use 'new NullPlugin()' instead of 'NullPlugin()'
Module not found: Error: Can't resolve 'webpack-null-plugin'
Package not installed or missing from package.json
fix
Run 'npm install webpack-null-plugin --save-dev'
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
webpack-null-plugin — npm install webpack-null-plugin · libregistry