@@ -7,6 +7,7 @@ const HotClientError = require('./lib/HotClientError');
77const { modifyCompiler, payload, sendData, validateCompiler } = require ( './lib/util' ) ;
88
99const defaults = {
10+ autoConfigure : true ,
1011 host : 'localhost' ,
1112 hot : true ,
1213 https : false ,
@@ -60,7 +61,9 @@ module.exports = (compiler, opts) => {
6061 log . warn ( '`options.host.client` does not match `options.host.server`. This can cause unpredictable behavior in the browser.' ) ;
6162 }
6263
63- validateCompiler ( compiler ) ;
64+ if ( options . autoConfigure ) {
65+ validateCompiler ( compiler ) ;
66+ }
6467
6568 const { host, port, server } = options ;
6669 const wssOptions = options . server ? { server } : { host : host . server , port } ;
@@ -93,7 +96,9 @@ module.exports = (compiler, opts) => {
9396 options . webSocket = { host : host . client , port } ;
9497 }
9598
96- modifyCompiler ( compiler , options ) ;
99+ if ( options . autoConfigure ) {
100+ modifyCompiler ( compiler , options ) ;
101+ }
97102
98103 const compile = ( comp ) => {
99104 const compilerName = comp . name || '<unnamed compiler>' ;
@@ -176,7 +181,9 @@ module.exports = (compiler, opts) => {
176181 }
177182 } ) ;
178183
179- if ( stats ) {
184+ // only send stats to newly connected clients if no previous clients have
185+ // connected
186+ if ( stats && ! wss . clients . length ) {
180187 const jsonStats = stats . toJson ( options . stats ) ;
181188
182189 /* istanbul ignore if */
0 commit comments