You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. You should see an overlay in browser for compilation errors.
32
32
3. Update `entry` in webpack.config.js to `app.js` and save.
33
33
4. You should see the text on the page itself change to read `Success!`.
34
+
35
+
## Additional Configurations
36
+
37
+
### Filter errors by function
38
+
39
+
**webpack.config.js**
40
+
41
+
```js
42
+
module.exports= {
43
+
devServer: {
44
+
client: {
45
+
overlay: {
46
+
runtimeErrors: (msg) => {
47
+
if (msg) {
48
+
if (msg instanceofDOMException&&msg.name==="AbortError") {
49
+
returnfalse;
50
+
}
51
+
52
+
let msgString;
53
+
54
+
if (msg instanceofError) {
55
+
msgString =msg.message;
56
+
} elseif (typeof msg ==="string") {
57
+
msgString = msg;
58
+
}
59
+
60
+
if (msgString) {
61
+
return!/something/i.test(msgString);
62
+
}
63
+
}
64
+
65
+
returntrue;
66
+
},
67
+
},
68
+
},
69
+
},
70
+
};
71
+
```
72
+
73
+
Run the command:
74
+
75
+
```shell
76
+
npx webpack serve --open
77
+
```
78
+
79
+
What should happens:
80
+
81
+
1. When you click the "Click to throw error" button, the overlay should appears.
82
+
1. When you click the "Click to throw ignored error" button, the overlay should not appear but you should see an error is logged in console (default browser behavior).
83
+
1. When you click the "Click to throw unhandled promise rejection" button, the overlay should appears.
84
+
1. When you click the "Click to throw ignored promise rejection" button, the overlay should not appear but you should see an error is logged in console (default browser behavior).
0 commit comments