Passing in V8 flags to a node process that executes ng build/serve throws #28901
Labels
area: @angular/build
freq1: low
Only reported by a handful of users who observe it rarely
severity5: regression
type: bug/fix
Command
build
Is this a regression?
The previous version in which this bug was not present was
18.2.12
Description
I am firing a
nodejs
process that executes theng build
schematic.For example, it looks something like this -
node --max-old-space-size=4096 node_modules/@angular/cli/bin/ng build
. This throws because of the--max-old-space-size
V8 flag that I pass in tonode
.I traced the problem to this PR#28758 which uses
process.execArgv
and passes them in asexecArgv
to theoptions
of the newly-created worker. Later onpiscina
will spawn a worker with the provided options, without doing any filtering, but I figured this is the intended behavior on their part.According to
nodejs
when spawning worker threads, we cannot pass in any V8 flags (ref). Also, there's an open issue nodejs/node#41103 to make worker threads stop throwing errors for unsupported options but until that is resolved my best guess is that ifprocess.execArgv
is to be used, then some sort of filtering should be applied on these options before passing them in to the worker's constructor.Minimal Reproduction
1, Create a new application with
@angular/cli@19
.2. Navigate to the newly-created project's root.
3. Run
node --max-old-space-size=4096 node_modules/@angular/cli/bin/ng build
Exception or Error
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: