Skip to content

Commit ae9539d

Browse files
fix: warning should not result in non-zero exit code (#1872)
Co-authored-by: James George <[email protected]>
1 parent 77b7da5 commit ae9539d

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ You can read more about [Scaffolding](https://webpack.js.org/guides/scaffolding)
102102
| Exit Code | Description |
103103
| --------- | -------------------------------------------------- |
104104
| `0` | Success |
105-
| `1` | Warnings/Errors from webpack |
105+
| `1` | Errors from webpack |
106106
| `2` | Configuration/options problem or an internal error |
107107

108108
## Contributing and Internal Documentation

packages/webpack-cli/lib/utils/Compiler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Compiler {
5353
logger.error(err.stack || err);
5454
process.exit(1); // eslint-disable-line
5555
}
56-
if (!outputOptions.watch && (stats.hasErrors() || stats.hasWarnings())) {
56+
if (!outputOptions.watch && stats.hasErrors()) {
5757
process.exitCode = 1;
5858
}
5959
if (outputOptions.json === true) {

test/loader/warning-test/loader-warning.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ describe('loader warning test', () => {
88

99
expect(stdout).toContain('[1 warning]');
1010
expect(stdout).toContain('This is a warning');
11-
expect(exitCode).not.toEqual(0);
11+
expect(exitCode).toEqual(0);
1212
});
1313
});

test/loader/warning-test/webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ module.exports = {
2727
'my-loader': require.resolve('./my-loader'),
2828
},
2929
},
30+
performance: {
31+
hints: 'warning',
32+
},
3033
};

0 commit comments

Comments
 (0)