@@ -88,6 +88,8 @@ export class SocketServer {
88
88
89
89
private reportedBrowserLogs : Set < string > = new Set ( ) ;
90
90
91
+ private currentHash : Map < string , string > = new Map ( ) ;
92
+
91
93
constructor (
92
94
context : InternalContext ,
93
95
options : DevConfig ,
@@ -332,10 +334,9 @@ export class SocketServer {
332
334
return null ;
333
335
}
334
336
335
- const defaultStats : Record < string , boolean > = {
337
+ const defaultStats : Rspack . StatsOptions = {
336
338
all : false ,
337
339
hash : true ,
338
- assets : true ,
339
340
warnings : true ,
340
341
warningsCount : true ,
341
342
errors : true ,
@@ -383,7 +384,7 @@ export class SocketServer {
383
384
const newInitialChunks : Set < string > = new Set ( ) ;
384
385
if ( statsJson . entrypoints ) {
385
386
for ( const entrypoint of Object . values ( statsJson . entrypoints ) ) {
386
- const chunks = entrypoint . chunks ;
387
+ const { chunks } = entrypoint ;
387
388
388
389
if ( ! Array . isArray ( chunks ) ) {
389
390
continue ;
@@ -411,19 +412,22 @@ export class SocketServer {
411
412
return ;
412
413
}
413
414
414
- const shouldEmit =
415
- ! force &&
416
- statsJson &&
417
- ! statsJson . errorsCount &&
418
- statsJson . assets &&
419
- statsJson . assets . every ( ( asset : any ) => ! asset . emitted ) ;
420
-
421
- if ( shouldEmit ) {
422
- this . sockWrite ( { type : 'ok' } , token ) ;
423
- return ;
424
- }
425
-
426
415
if ( statsJson . hash ) {
416
+ const prevHash = this . currentHash . get ( token ) ;
417
+ this . currentHash . set ( token , statsJson . hash ) ;
418
+
419
+ // If build hash is not changed and there is no error or warning, skip emit
420
+ const shouldEmit =
421
+ ! force &&
422
+ ! statsJson . errorsCount &&
423
+ ! statsJson . warningsCount &&
424
+ prevHash === statsJson . hash ;
425
+
426
+ if ( shouldEmit ) {
427
+ this . sockWrite ( { type : 'ok' } , token ) ;
428
+ return ;
429
+ }
430
+
427
431
this . sockWrite (
428
432
{
429
433
type : 'hash' ,
@@ -469,7 +473,6 @@ export class SocketServer {
469
473
}
470
474
471
475
this . sockWrite ( { type : 'ok' } , token ) ;
472
- return ;
473
476
}
474
477
475
478
// send message to connecting socket
0 commit comments