{"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,"search_vec":"'2016':52 'activ':67 'allow':35 'altern':57 'array':65 'condit':31,60 'configur':29 'depend':45 'develop':68 'empti':72 'includ':32 'inlin':59 'intend':25 'javascript':69 'logic':61 'no-op':13 'noth':40 'npm':7 'null':3,20,71 'object':21 'op':15 'packag':8,42 'pattern':22 'placehold':37 'plugin':4,17,33,64,73 'provid':11 'seen':48 'simpl':56 'simplifi':27 'sinc':51 'tini':6 'updat':50 'use':18 'v0.0.2':9 'webpack':2,16,28,70 'webpack-null-plugin':1","created_at":"2026-04-25T11:25:03.640323+00:00","updated_at":"2026-04-25T11:25:03.640323+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/webpack-null-plugin","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}