disable-output-webpack-plugin

raw JSON →
1.0.1 verified Sat Apr 25 auth: no javascript

Webpack plugin that prevents saving output files to disk, useful for scenarios where you only need webpack's in-memory compilation (e.g., with webpack-dev-server or custom runners). Version 1.0.1 is current, no frequent releases. Simple no-config plugin, lighter than alternatives like `webpack-disk-plugin`. Likely no longer needed with webpack 5's `output.writeToDisk` option.

error TypeError: DisableOutputWebpackPlugin is not a constructor
cause Using ES module import syntax (`import DisableOutputWebpackPlugin from ...`) which doesn't resolve to the CommonJS export correctly.
fix
Use const DisableOutputWebpackPlugin = require('disable-output-webpack-plugin') instead of import.
error Module not found: Error: Can't resolve 'disable-output-webpack-plugin'
cause Package not installed or missing from node_modules.
fix
Run npm install --save-dev disable-output-webpack-plugin.
error Error: You forgot to add 'mini-css-extract-plugin' plugin
cause Not related to this plugin; it's a common confusion with other plugins.
fix
Ensure other plugins like MiniCssExtractPlugin are properly configured if used.
gotcha The plugin only works with webpack 4 and lower; webpack 5 has native support via `output.writeToDisk: false`.
fix Use webpack 5's built-in `output.writeToDisk: false` instead.
gotcha The constructor accepts no options; passing any argument will be silently ignored.
fix Remove any arguments from `new DisableOutputWebpackPlugin()`.
gotcha If using webpack-dev-server, output is already not written to disk by default, making this plugin redundant.
fix Remove the plugin; webpack-dev-server handles in-memory compilation.
npm install disable-output-webpack-plugin
yarn add disable-output-webpack-plugin
pnpm add disable-output-webpack-plugin

Basic setup to disable webpack output file writing. Note: output.path is still needed but files are not saved.

// webpack.config.js
const DisableOutputWebpackPlugin = require('disable-output-webpack-plugin');

module.exports = {
  entry: './src/index.js',
  output: {
    path: '/dev/null', // still required but output won't be written
    filename: 'bundle.js'
  },
  plugins: [
    new DisableOutputWebpackPlugin()
  ]
};