nodejs / nodejs/node

`--conditions xxx` cannot pass into `worker_thread`

Aperta
#50,885 21 commenti 1 reazione 1 assegnatario Vedi su GitHub

@juanarbol ci sta già lavorando.

Dal 23/11/2023.

confirmed-bug esm loaders module worker
Lingua principale
JavaScript
Stelle
122k
Fork
37.3k
Merge medio
4g 2h
PR unite (30g)
283

Descrizione

Version

v20.10.0

Platform

Darwin Alexs-MacBook-Pro.local 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:28:45 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6020 arm64

Subsystem

module

What steps will reproduce the bug?
// main.js
import { Worker } from 'node:worker_threads'

new Worker(new URL('worker.js', import.meta.url), {
  execArgv: ['--conditions', 'react-server']
})
// worker.js
import { register } from 'node:module'

register('./register.js', import.meta.url)

console.log('1')

import('./test.js')
// register.js
export async function resolve (specifier, context, nextResolve) {
  // Take an `import` or `require` specifier and resolve it to a URL.
  console.log('context', context.conditions)
  return nextResolve(specifier, context, nextResolve)
}

export async function load (url, context, nextLoad) {
  return nextLoad(url, context, nextLoad)
}
// test.js
console.log('3')
How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?
1
context [ 'node', 'import', 'node-addons', 'react-server' ]
3
What do you see instead?
1
context [ 'node', 'import', 'node-addons' ]
3
Additional information

Might cause RSC bundle issue https://github.com/dai-shi/waku/pull/178

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.