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 @@ -534,6 +534,19 @@ class ModuleLoader {
534534 const type = requestType === kRequireInImportedCJS ? 'require' : 'import' ;
535535 process . send ( { [ `watch:${ type } ` ] : [ url ] } ) ;
536536 }
537+
538+ // Relay Events from worker to main thread
539+ if ( process . env . WATCH_REPORT_DEPENDENCIES && ! process . send ) {
540+ const { isMainThread } = internalBinding ( 'worker' ) ;
541+ if ( isMainThread ) {
542+ return ;
543+ }
544+ const { parentPort } = require ( 'worker_threads' ) ;
545+ if ( ! parentPort ) {
546+ return ;
547+ }
548+ parentPort . postMessage ( { 'watch:import' : [ url ] } ) ;
549+ }
537550
538551 // TODO(joyeecheung): update the module requests to use importAttributes as property names.
539552 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