@@ -11,9 +11,6 @@ const {
1111 ObjectDefineProperty,
1212 PromisePrototypeThen,
1313 RegExpPrototypeExec,
14- globalThis : {
15- SharedArrayBuffer,
16- } ,
1714} = primordials ;
1815
1916const {
@@ -119,23 +116,21 @@ port.on('message', (message) => {
119116 require ( 'internal/worker' ) . assignEnvironmentData ( environmentData ) ;
120117 setupMainThreadPort ( mainThreadPort ) ;
121118
122- if ( SharedArrayBuffer !== undefined ) {
123- // The counter is only passed to the workers created by the main thread,
124- // not to workers created by other workers.
125- let cachedCwd = '' ;
126- let lastCounter = - 1 ;
127- const originalCwd = process . cwd ;
128-
129- process . cwd = function ( ) {
130- const currentCounter = AtomicsLoad ( cwdCounter , 0 ) ;
131- if ( currentCounter === lastCounter )
132- return cachedCwd ;
133- lastCounter = currentCounter ;
134- cachedCwd = originalCwd ( ) ;
119+ // The counter is only passed to the workers created by the main thread,
120+ // not to workers created by other workers.
121+ let cachedCwd = '' ;
122+ let lastCounter = - 1 ;
123+ const originalCwd = process . cwd ;
124+
125+ process . cwd = function ( ) {
126+ const currentCounter = AtomicsLoad ( cwdCounter , 0 ) ;
127+ if ( currentCounter === lastCounter )
135128 return cachedCwd ;
136- } ;
137- workerIo . sharedCwdCounter = cwdCounter ;
138- }
129+ lastCounter = currentCounter ;
130+ cachedCwd = originalCwd ( ) ;
131+ return cachedCwd ;
132+ } ;
133+ workerIo . sharedCwdCounter = cwdCounter ;
139134
140135 const isLoaderHookWorker = ( filename === 'internal/modules/esm/worker' && doEval === 'internal' ) ;
141136 if ( ! isLoaderHookWorker ) {
0 commit comments