
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
warnings-to-errors-webpack-plugin
Advanced tools
Change every warning as error to ensure safe build
Table of contents
Even if the build result with webpack has some warnings, the build can succeed with no error exit codes. This can be trouble if some developer not carefully sees the result of CI service. By changing all warnings to errors, webpack can recognize every warning as an error.
$ npm i -D warnings-to-errors-webpack-plugin
# or
$ yarn add -D warnings-to-errors-webpack-plugin
const WarningsToErrorsPlugin = require('warnings-to-errors-webpack-plugin');
module.exports = {
// ...
plugins: [
new WarningsToErrorsPlugin(),
],
};
warningsFilter
and ignoreWarnings
This plugin ignores warnings that are matched by warningsFilter
or ignoreWarnings
without recognizing them as errors.
// webpack v5
{
plugins: [
new WarningsToErrorsPlugin(),
],
ignoreWarnings: [
{
message: /compilation warning/,
},
],
}
If you use ignoreWarnings
and warningsFilter
options at the same time in webpack v5, the plugin will ignore all matched warnings in both. but recommend using ignoreWarnings
.
// webpack v5
{
plugins: [
new WarningsToErrorsPlugin(),
],
ignoreWarnings: [
{
message: /compilation warning 1/,
},
],
stats: {
warningsFilter: [
/compilation warning 2/,
],
},
}
// webpack v2, v3 and v4
{
plugins: [
new WarningsToErrorsPlugin(),
],
stats: {
warningsFilter: [
/compilation warning/,
],
},
}
NoEmitOnErrorsPlugin
Skip the emitting phase whenever there are warnings while compiling. this ensures that no assets are emitted that include warnings.
// webpack >= v4
{
optimization: {
noEmitOnErrors: true,
},
plugins: [
new WarningsToErrorsPlugin();
],
};
// webpack v2 and v3
{
plugins: [
new WarningsToErrorsPlugin(),
new NoEmitOnErrorsPlugin(),
],
};
MIT © Taehwan Noh
FAQs
Change every warning as error to ensure safe build
The npm package warnings-to-errors-webpack-plugin receives a total of 36,239 weekly downloads. As such, warnings-to-errors-webpack-plugin popularity was classified as popular.
We found that warnings-to-errors-webpack-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.