File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # client.logging Option
2+
3+ ` 'log' | 'info' | 'warn' | 'error' | 'none' | 'verbose' `
4+
5+ Allows to set log level in the browser, e.g. before reloading, before an error or when Hot Module Replacement is enabled.
6+
7+ ** webpack.config.js**
8+
9+ ``` js
10+ module .exports = {
11+ // ...
12+ devServer: {
13+ client: {
14+ logging: " info" ,
15+ },
16+ },
17+ };
18+ ```
19+
20+ Usage via CLI:
21+
22+ ``` shell
23+ npx webpack serve --open --client-logging info
24+ ```
25+
26+ ## What Should Happen
27+
28+ 1 . The script should open ` http://localhost:8080/ ` in your default browser.
29+ 2 . You should see an overlay in browser for compilation warnings.
30+ 3 . Open the console in your browser's devtools.
31+
32+ In the devtools console you should see:
33+
34+ ```
35+ [HMR] Waiting for update signal from WDS...
36+ [webpack-dev-server] Hot Module Replacement enabled.
37+ [webpack-dev-server] Live Reloading enabled.
38+ [webpack-dev-server] Warnings while compiling.
39+ [webpack-dev-server] Manual warnings produced during compilation.
40+ ```
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ const target = document . querySelector ( "#target" ) ;
4+
5+ target . classList . add ( "pass" ) ;
6+ target . innerHTML = "Success!" ;
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ // our setup function adds behind-the-scenes bits to the config that all of our
4+ // examples need
5+ const { setup } = require ( "../../util" ) ;
6+
7+ module . exports = setup ( {
8+ context : __dirname ,
9+ entry : "./app.js" ,
10+ plugins : [
11+ {
12+ apply ( compiler ) {
13+ compiler . hooks . thisCompilation . tap (
14+ "warnings-webpack-plugin" ,
15+ ( compilation ) => {
16+ compilation . warnings . push (
17+ new Error ( "Manual warnings produced during compilation." )
18+ ) ;
19+ }
20+ ) ;
21+ } ,
22+ } ,
23+ ] ,
24+ devServer : {
25+ client : {
26+ logging : "info" ,
27+ } ,
28+ } ,
29+ } ) ;
You can’t perform that action at this time.
0 commit comments