-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Labels
workerIssues and PRs related to Worker support.Issues and PRs related to Worker support.
Description
- Version: 12.3.1
- Platform: all
- Subsystem: workers
- Tl;dr:
process._preload_modulesshould be forwarded to the workers
This one is a bit convoluted ... first some context:
- Yarn 2 keeps the vendors within zip archives instead of unpacking them
- To make it work, NODE_OPTIONS contains
--require /path/to/.pnp.js - This
.pnp.jsextends thefsmodule to add support for in-zip reading - Parcel 2, a vendor (and thus stored within a zip), uses
worker_threadsif possible
It works fine with child_process.fork, because under the regular CLI the --require scripts are executed before the entry point is resolved (except when using --inspect if I remember correctly), so by the time runMain is called the zip archives can be accessed.
However, with worker_threads it seems that the NODE_OPTIONS --require entries are completely ignored and runMain is called directly, causing the script to be executed outside of the PnP context and thus not being able to access its dependencies or even spawn if stored within a zip archive (which is the case by default, although it can be disabled).
mischnic
Metadata
Metadata
Assignees
Labels
workerIssues and PRs related to Worker support.Issues and PRs related to Worker support.