TypeStrong / fork-ts-checker-webpack-plugin

Webpack plugin that runs typescript type checker on a separate process.
MIT License
1.93k stars 238 forks source link

`createRpcWorker` should not override `execArgv` #845

Open mook-as opened 1 month ago

mook-as commented 1 month ago

Current behavior

I have a project that seems to blow up TypeScript because there are too many generics involved; I have to build it with node --stack-size=… so that the stack is big enough.

Note that it appears that NodeJS does not allow setting this option via NODE_OPTIONS.

However, rpc-worker#createRpcWorker currently clobbers options.execArgv if a memory limit is set, which it always is. This means that I can't pass it in on the command line.

Expected behavior

The relevant line: https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/blob/0fab463b21c6edc4d94834568a3f440241d57887/src/rpc/rpc-worker.ts#L32

It would be nice if that's something along the lines of:

    options.execArgv = process.execArgv.concat([`--max-old-space-size=${memoryLimit}`]);

Steps to reproduce the issue

I suppose the easiest would be:

  1. Launch webpack with --stack-size=… arguments.
  2. Check ps output (or equivalent) to see that the TypeScriptReporterRpcService.js processes do not have --stack-size=… in the command line. (They have --max-old-space-size=2048 instead.)

Issue reproduction repository

Sorry, I don't have a minimal test case; hopefully I have provided enough information to be clear what the issue is.

Environment