Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.

Commit 3f0bbc7

Browse files
author
Rogelio Guzman
committed
Add documentation for turning off errors
1 parent 8470e14 commit 3f0bbc7

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ npm install friendly-errors-webpack-plugin --save-dev
2020

2121
### Basic usage
2222

23-
Simply add `FriendlyErrorsWebpackPlugin` to the plugin section in your Webpack config.
23+
Simply add `FriendlyErrorsWebpackPlugin` to the plugin section in your Webpack config.
2424

2525
```javascript
2626
var FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
@@ -34,6 +34,27 @@ var webpackConfig = {
3434
}
3535
```
3636

37+
### Turn off errors
38+
39+
You need to turn off all error logging by setting your webpack config quiet option to true.
40+
41+
```javascript
42+
app.use(require('webpack-dev-middleware')(compiler, {
43+
quiet: true,
44+
publicPath: config.output.publicPath,
45+
}));
46+
```
47+
48+
If you use webpack-hot-middleware, that is done by setting the log option to a no-op. You can do something sort of like this, depending upon your setup:
49+
50+
```javascript
51+
app.use(require('webpack-hot-middleware')(compiler, {
52+
log: () => {}
53+
}));
54+
```
55+
56+
_Thanks to [webpack-dashboard](https://github.com/FormidableLabs/webpack-dashboard) for this piece of info._
57+
3758
## Demo
3859

3960
### Build success
@@ -69,7 +90,7 @@ new FriendlyErrorsPlugin({
6990
// should the console be cleared between each compilation?
7091
// default is true
7192
shouldClearConsole: true,
72-
93+
7394
// add formatters and transformers (see below)
7495
additionalFormatters: [],
7596
additionalTransformers: []
@@ -108,7 +129,7 @@ new NotifierPlugin({
108129
### Transformers and formatters
109130

110131
Webpack's errors processing, is done in four phases:
111-
132+
112133
1. Extract relevant info from webpack errors. This is done by the plugin [here](https://github.com/geowarin/friendly-errors-webpack-plugin/blob/master/src/core/extractWebpackError.js)
113134
2. Apply transformers to all errors to identify and annotate well know errors and give them a priority
114135
3. Get only top priority error or top priority warnings if no errors are thrown

0 commit comments

Comments
 (0)