Registry / devops / fail-on-errors-webpack-plugin

fail-on-errors-webpack-plugin

JSON →
library3.0.0jsnpmunverified

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.

npm install fail-on-errors-webpack-plugin
INSTALL
IMPORT
SIG · FAIL-ON-ERRORS-WEB
F
fail-on-errors-webpack-plugin
devopsjavascriptv3.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FailOnErrorsPlugin
const FailOnErrorsPlugin = require('fail-on-errors-webpack-plugin');
import FailOnErrorsPlugin from 'fail-on-errors-webpack-plugin';
CommonJS only; no ESM export. Use require() in webpack.config.js.
Options
typedef {Object} Options # {failOnErrors?: boolean, failOnWarnings?: boolean}
import { Options } from 'fail-on-errors-webpack-plugin';
Options is not exported; it's just inline documentation. TypeScript users should define their own interface.
FailOnErrorsPlugin (new)
new FailOnErrorsPlugin({ failOnErrors: true, failOnWarnings: true })
new FailOnErrorsPlugin(true, true)
Constructor expects a single options object, not multiple arguments.

Adds the FailOnErrorsPlugin to a Webpack config to fail the build on errors and warnings.

// webpack.config.js const FailOnErrorsPlugin = require('fail-on-errors-webpack-plugin'); module.exports = { entry: './src/index.js', output: { filename: 'bundle.js' }, plugins: [ new FailOnErrorsPlugin({ failOnErrors: true, failOnWarnings: true, }) ] };
Debug
Known issues
breakingForked from webpack-fail-plugin; API changed from constructor arguments to options object.
fix
Pass an object { failOnErrors: boolean, failOnWarnings: boolean } instead of positional arguments.
affects: >=1.0.0
deprecatedWebpack 5 support is experimental; no official statement.
fix
Test with Webpack 5; consider alternatives like webpack-stats-plugin or built-in emitError/emitWarning.
affects: >=3.0.0
gotchaIf both failOnErrors and failOnWarnings are false, plugin does nothing; process will still exit 0 on errors/warnings.
fix
Set at least one option to true to get the desired behavior.
affects: >=1.0.0
gotchaPlugin uses process.on('exit') to set process.exitCode = 1; may conflict with other exit handlers.
fix
Be careful when combining with other plugins that manipulate exit codes.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: FailOnErrorsPlugin is not a constructor
Using import instead of require; the package is CommonJS only.
fix
Replace 'import FailOnErrorsPlugin from ...' with 'const FailOnErrorsPlugin = require(...)'
ValidationError: Invalid options object. FailOnErrorsPlugin has been initialized using an options object that does not match the API schema.
Passing multiple arguments instead of a single options object.
fix
new FailOnErrorsPlugin({ failOnErrors: true, failOnWarnings: true })
Error: Cannot find module 'fail-on-errors-webpack-plugin'
Package not installed or version mismatch (e.g., used with npm/yarn and not present).
fix
Run 'npm install fail-on-errors-webpack-plugin --save-dev'
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
webpackrequiredpeer dependency; plugin runs inside Webpack's compilation lifecycle
Agent activity
4 hits · last 30 days
node
4
Resources
fail-on-errors-webpack-plugin — npm install fail-on-errors-webpack-plugin · libregistry