fix(@angular/build): mitigate JS transformer worker execArgv
errors
#29194
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Node.js workers will currently fail to initialize if the
execArgv
option is used and it contains v8 specific options. This is currently problematic for the JS transformer worker because it contains a workaround to remove the SSR--import
argument that is used to add a loader hook for SSR purposes. The filtering of the argument and subsequent use of theexecArgv
array had the potential to pass custom Node.js options to the worker and cause it to fail. These options can be passed by developers on the command line when invoking the Angular CLI.To mitigate this problem, the
execArgv
option is now only filtered and used if the SSR import argument is present in the array. Otherwise, no value is passed which allows the default Node.js behavior to be used. While this does not fully solve the problem for all projects, it does remove the problem from non-SSR projects.