Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ Type: `Boolean`

If `true`, instructs the client to attempt to reconnect all `WebSockets` when their connects are interrupted, usually as a result of the server being stopped and/or restarted. _Note: This can be very spammy in the browser console, as there is no way to suppress error messages from the browser when a `WebSocket` fails to connect._

#### `client.silent`
Type: `Boolean`

If `true`, instructs the client not to log anything to the console.


### `compress`
Type: `Boolean`<br>
Default: `false`
Expand Down
2 changes: 1 addition & 1 deletion client.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
try {
options = ʎɐɹɔosǝʌɹǝs;
} catch (e) {
const log = require('./lib/client/log');
const { log } = require('./lib/client/log');
log.error(
'The entry for webpack-plugin-serve was included in your build, but it does not appear that the plugin was. Please check your configuration.'
);
Expand Down
3 changes: 2 additions & 1 deletion lib/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
const run = (buildHash, options) => {
const { ClientSocket } = require('./ClientSocket');
const { replace } = require('./hmr');
const { error, info, warn } = require('./log');
const { log, silent } = require('./log');
const { error, info, warn } = options.silent ? silent : log;

const { address, client = {}, progress, secure, status } = options;
const protocol = secure ? 'wss' : 'ws';
Expand Down
8 changes: 7 additions & 1 deletion lib/client/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@ const log = {
refresh: 'Please refresh the page',
warn: warn.bind(console, '⬡ wps:')
};
const noop = () => {};
const silent = {
error: noop,
info: noop,
warn: noop
};

module.exports = log;
module.exports = { log, silent };