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
muslnode 18–226 runs
build_error
glibcnode 18–226 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 }));
});
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())
fixUse 'new NullPlugin()' instead of 'NullPlugin()'
Module not found: Error: Can't resolve 'webpack-null-plugin'
Package not installed or missing from package.json
fixRun 'npm install webpack-null-plugin --save-dev'
Audit
Dependencies
No dependency data recorded yet.