{"id":20023,"library":"fail-on-errors-webpack-plugin","title":"FailOnErrorsPlugin","description":"Webpack plugin that forces the build process to exit with a non-zero exit code (status code 1) when compilation has any errors or warnings, superseding the default behavior where Webpack only fails on hard errors. Version 3.0.0 supports Webpack 4+. Useful for CI/CD pipelines to catch soft errors and warnings that would otherwise pass the build. A maintained fork of the abandoned webpack-fail-plugin.","status":"active","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/AustinMatherne/fail-on-errors-webpack-plugin","tags":["javascript","webpack"],"install":[{"cmd":"npm install fail-on-errors-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add fail-on-errors-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add fail-on-errors-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; plugin runs inside Webpack's compilation lifecycle","package":"webpack","optional":false}],"imports":[{"note":"CommonJS only; no ESM export. Use require() in webpack.config.js.","wrong":"import FailOnErrorsPlugin from 'fail-on-errors-webpack-plugin';","symbol":"FailOnErrorsPlugin","correct":"const FailOnErrorsPlugin = require('fail-on-errors-webpack-plugin');"},{"note":"Options is not exported; it's just inline documentation. TypeScript users should define their own interface.","wrong":"import { Options } from 'fail-on-errors-webpack-plugin';","symbol":"Options","correct":"typedef {Object} Options # {failOnErrors?: boolean, failOnWarnings?: boolean}"},{"note":"Constructor expects a single options object, not multiple arguments.","wrong":"new FailOnErrorsPlugin(true, true)","symbol":"FailOnErrorsPlugin (new)","correct":"new FailOnErrorsPlugin({ failOnErrors: true, failOnWarnings: true })"}],"quickstart":{"code":"// webpack.config.js\nconst FailOnErrorsPlugin = require('fail-on-errors-webpack-plugin');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: { filename: 'bundle.js' },\n  plugins: [\n    new FailOnErrorsPlugin({\n      failOnErrors: true,\n      failOnWarnings: true,\n    })\n  ]\n};","lang":"javascript","description":"Adds the FailOnErrorsPlugin to a Webpack config to fail the build on errors and warnings."},"warnings":[{"fix":"Pass an object { failOnErrors: boolean, failOnWarnings: boolean } instead of positional arguments.","message":"Forked from webpack-fail-plugin; API changed from constructor arguments to options object.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Test with Webpack 5; consider alternatives like webpack-stats-plugin or built-in emitError/emitWarning.","message":"Webpack 5 support is experimental; no official statement.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Set at least one option to true to get the desired behavior.","message":"If both failOnErrors and failOnWarnings are false, plugin does nothing; process will still exit 0 on errors/warnings.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Be careful when combining with other plugins that manipulate exit codes.","message":"Plugin uses process.on('exit') to set process.exitCode = 1; may conflict with other exit handlers.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Replace 'import FailOnErrorsPlugin from ...' with 'const FailOnErrorsPlugin = require(...)'","cause":"Using import instead of require; the package is CommonJS only.","error":"TypeError: FailOnErrorsPlugin is not a constructor"},{"fix":"new FailOnErrorsPlugin({ failOnErrors: true, failOnWarnings: true })","cause":"Passing multiple arguments instead of a single options object.","error":"ValidationError: Invalid options object. FailOnErrorsPlugin has been initialized using an options object that does not match the API schema."},{"fix":"Run 'npm install fail-on-errors-webpack-plugin --save-dev'","cause":"Package not installed or version mismatch (e.g., used with npm/yarn and not present).","error":"Error: Cannot find module 'fail-on-errors-webpack-plugin'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}