{"id":20802,"library":"webpack-null-plugin","title":"webpack-null-plugin","description":"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.","status":"deprecated","version":"0.0.2","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","webpack","null","empty","plugin"],"install":[{"cmd":"npm install webpack-null-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-null-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-null-plugin","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package exports a single class via default export. There is no named export.","wrong":"const NullPlugin = require('webpack-null-plugin')","symbol":"default","correct":"import NullPlugin from 'webpack-null-plugin'"},{"note":"Do not destructure require; the package does not export a named NullPlugin.","wrong":"const { NullPlugin } = require('webpack-null-plugin')","symbol":"NullPlugin","correct":"import NullPlugin from 'webpack-null-plugin'"},{"note":"When using TypeScript, you may want to type the plugin array. The import for the type comes from 'webpack', not this package.","wrong":"","symbol":"WebpackPluginInstance","correct":"import type { WebpackPluginInstance } from 'webpack'"}],"quickstart":{"code":"const NullPlugin = require('webpack-null-plugin');\nconst shouldUsePlugin = process.env.USE_SOMETHING === 'true';\nconst webpack = require('webpack');\n\nconst compiler = webpack({\n  // ... other config\n  plugins: [\n    shouldUsePlugin ? new SomeRealPlugin() : new NullPlugin(),\n  ],\n});\n\ncompiler.run((err, stats) => {\n  if (err) {\n    console.error(err);\n    return;\n  }\n  console.log(stats.toString({ colors: true }));\n});","lang":"javascript","description":"Demonstrates conditionally including a real plugin or the NullPlugin in a webpack configuration."},"warnings":[{"fix":"Use inline conditional logic in the plugins array: plugins: [ condition && new Plugin() ].filter(Boolean)","message":"Package is deprecated: The null object pattern is unnecessary; simply conditionally include plugins in an array.","severity":"deprecated","affected_versions":">=0.0.1"},{"fix":"Always use 'new NullPlugin()' in the plugins array.","message":"Must be instantiated with 'new' before passing to webpack","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use 'new NullPlugin()' instead of 'NullPlugin()'","cause":"Omitting 'new' when using NullPlugin (e.g., calling NullPlugin() instead of new NullPlugin())","error":"TypeError: Class constructor NullPlugin cannot be invoked without 'new'"},{"fix":"Run 'npm install webpack-null-plugin --save-dev'","cause":"Package not installed or missing from package.json","error":"Module not found: Error: Can't resolve 'webpack-null-plugin'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}