digital-loukoum / esrun

Simple wrapper around esbuild to execute a Typescript file
MIT License
173 stars 11 forks source link

How to set `max-old-space-size`? #21

Closed shtse8 closed 2 years ago

shtse8 commented 2 years ago

It's a great project and very easy to run typescript with es module support. But my application is running out of heap size, so I would like to increase the size. After searching from internet, I need to increase the size by running node --max-old-space-size 4096 index.js I tried to enter something similar: esrun --max-old-space-size 4096 index.ts, but failed. Unknown option --max_old_space_size=5048 How to set max-old-space-size in runtime without setting env?

Gin-Quin commented 2 years ago

Thanks! The best fix would be to add support for arbitrary node options, like this:

esrun --node-max-old-space-size=4096 index.ts

I will work on this when I have some time available.

shtse8 commented 2 years ago

Thanks! The best fix would be to add support for arbitrary node options, like this:

esrun node:--max-old-space-size 4096 index.ts

I will work on this when I have some time available.

Perfect if we can add all node's flags support with node:. Is it possible to add -e too? Although it's not related to typescript. But we don't need to switch back to node command if we want to execute script directly.

Gin-Quin commented 2 years ago

You can now pass node options since esrun 3.2.10.

To pass an argument to the node cli, you need to prefix it with "--node", like this:

esrun --node-max-old-space-size=4096 index.ts