@@ -172,7 +172,7 @@ var connection = new SockJS(
172172// to avoid spamming the console. Disconnect usually happens
173173// when developer stops the server.
174174connection . onclose = function ( ) {
175- if ( typeof console !== 'undefined' ) {
175+ if ( typeof console !== 'undefined' && typeof console . info === 'function' ) {
176176 console . info (
177177 'The development server has disconnected.\nRefresh the page if necessary.'
178178 ) ;
@@ -186,8 +186,8 @@ var hasCompileErrors = false;
186186
187187function clearOutdatedErrors ( ) {
188188 // Clean up outdated compile errors, if any.
189- if ( typeof console !== 'undefined' ) {
190- if ( hasCompileErrors && typeof console . clear === 'function' ) {
189+ if ( typeof console !== 'undefined' && typeof console . clear === 'function' ) {
190+ if ( hasCompileErrors ) {
191191 console . clear ( ) ;
192192 }
193193 }
@@ -226,7 +226,7 @@ function handleWarnings(warnings) {
226226 errors : [ ] ,
227227 } ) ;
228228
229- if ( typeof console !== 'undefined' ) {
229+ if ( typeof console !== 'undefined' && typeof console . warn === 'function' ) {
230230 for ( var i = 0 ; i < formatted . warnings . length ; i ++ ) {
231231 console . warn ( stripAnsi ( formatted . warnings [ i ] ) ) ;
232232 }
@@ -266,7 +266,7 @@ function handleErrors(errors) {
266266 showErrorOverlay ( formatted . errors [ 0 ] ) ;
267267
268268 // Also log them to the console.
269- if ( typeof console !== 'undefined' ) {
269+ if ( typeof console !== 'undefined' && typeof console . error === 'function' ) {
270270 for ( var i = 0 ; i < formatted . errors . length ; i ++ ) {
271271 console . error ( stripAnsi ( formatted . errors [ i ] ) ) ;
272272 }
0 commit comments