File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -531,6 +531,19 @@ class ModuleLoader {
531531 const type = requestType === kRequireInImportedCJS ? 'require' : 'import' ;
532532 process . send ( { [ `watch:${ type } ` ] : [ url ] } ) ;
533533 }
534+
535+ // Relay Events from worker to main thread
536+ if ( process . env . WATCH_REPORT_DEPENDENCIES && ! process . send ) {
537+ const { isMainThread } = internalBinding ( 'worker' ) ;
538+ if ( isMainThread ) {
539+ return ;
540+ }
541+ const { parentPort } = require ( 'worker_threads' ) ;
542+ if ( ! parentPort ) {
543+ return ;
544+ }
545+ parentPort . postMessage ( { 'watch:import' : [ url ] } ) ;
546+ }
534547
535548 // TODO(joyeecheung): update the module requests to use importAttributes as property names.
536549 const importAttributes = resolveResult . importAttributes ?? request . attributes ;
Original file line number Diff line number Diff line change @@ -341,6 +341,9 @@ class Worker extends EventEmitter {
341341 if ( ArrayIsArray ( message ?. [ 'watch:require' ] ) ) {
342342 process . send ( { 'watch:require' : message [ 'watch:require' ] } ) ;
343343 }
344+ if ( ArrayIsArray ( message ?. [ 'watch:import' ] ) ) {
345+ process . send ( { 'watch:import' : message [ 'watch:import' ] } ) ;
346+ }
344347 } ) ;
345348 }
346349 this [ kPort ] . postMessage ( {
You can’t perform that action at this time.
0 commit comments