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 @@ -348,6 +348,9 @@ class Worker extends EventEmitter {
348348 if ( ArrayIsArray ( message ?. [ 'watch:require' ] ) ) {
349349 process . send ( { 'watch:require' : message [ 'watch:require' ] } ) ;
350350 }
351+ if ( ArrayIsArray ( message ?. [ 'watch:import' ] ) ) {
352+ process . send ( { 'watch:import' : message [ 'watch:import' ] } ) ;
353+ }
351354 } ) ;
352355 }
353356 this [ kPort ] . postMessage ( {
You can’t perform that action at this time.
0 commit comments