File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -518,6 +518,19 @@ class ModuleLoader {
518518 const type = requestType === kRequireInImportedCJS ? 'require' : 'import' ;
519519 process . send ( { [ `watch:${ type } ` ] : [ url ] } ) ;
520520 }
521+
522+ // Relay Events from worker to main thread
523+ if ( process . env . WATCH_REPORT_DEPENDENCIES && ! process . send ) {
524+ const { isMainThread } = internalBinding ( 'worker' ) ;
525+ if ( isMainThread ) {
526+ return ;
527+ }
528+ const { parentPort } = require ( 'worker_threads' ) ;
529+ if ( ! parentPort ) {
530+ return ;
531+ }
532+ parentPort . postMessage ( { 'watch:import' : [ url ] } ) ;
533+ }
521534
522535 // TODO(joyeecheung): update the module requests to use importAttributes as property names.
523536 const importAttributes = resolveResult . importAttributes ?? request . attributes ;
Original file line number Diff line number Diff line change @@ -347,6 +347,9 @@ class Worker extends EventEmitter {
347347 if ( ArrayIsArray ( message ?. [ 'watch:require' ] ) ) {
348348 process . send ( { 'watch:require' : message [ 'watch:require' ] } ) ;
349349 }
350+ if ( ArrayIsArray ( message ?. [ 'watch:import' ] ) ) {
351+ process . send ( { 'watch:import' : message [ 'watch:import' ] } ) ;
352+ }
350353 } ) ;
351354 }
352355 this [ kPort ] . postMessage ( {
You can’t perform that action at this time.
0 commit comments