jaydenseric/apollo-upload-client

crash with recommended ts parameters of release 18.0.0

devkral opened this issue · 4 comments

Setting globally in my project the recommended values:

    "allowJs": true,
    "maxNodeModuleJsDepth": 10,

is a memory hog and causes oom crashes with my webpack/ ts-loader setup. I have to restrict this setting to a submodule.

It would be nice to have a better solutions

sa-ma commented

How did you restrict this to a submodule? I am having similar issues

sry short in time. Here is a guide:
https://www.typescriptlang.org/docs/handbook/project-references.html

Sry, it is called subprojects, effective they are submodules you can reference in package.json

My project with working apollo-upload-client integration is here (and the subprojects):
https://github.com/secretgraph/secretgraph

See js-packages/misc

I've used TypeScript config similar to the suggestions in the documented requirements for years now in real world projects of varying sizes and never noticed a memory issue, although to be fair I have a high spec M1 MacBook Pro. It's been fine in low memory GitHub Actions CI environments tho.

You might be able to play around with "maxNodeModuleJsDepth": 10 and try something like 3 or 4; 10 is arbitrary. You might also want to check that node_modules is in the TS config exclude list; TypeScript would then not look for all the JS in there unless you explicitly import a module. There's probably other things you could look into as well.

Closing because this issue likely is project specific in nature and not something I can really action or debug here. If there is a better way to document TypeScript requirements, I would update the many different packages I maintain at the same time for consistency and it would be a big effort.

If anyone figures out what it was specifically that was causing memory issues in their project and what alleviated it, feel free to share here. If there is in fact something specific I can recommend in the readme I'll consider reopening this issue or improving docs. Moving types out of the published module code (currently TypeScript JSDoc) and into separately generated definitions files is not up for consideration.

levrik commented

To everyone stumbling across this issue: Just continue using @types/apollo-upload-client which is still updated.
I don't understand why @jaydenseric chose to put that much friction and quite unusual configuration requirements in place but it is what it is and there's an easy way to avoid it.