Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve profiling / flamegraph experience for typescript #49297

Closed
Raynos opened this issue Aug 23, 2023 · 2 comments
Closed

Improve profiling / flamegraph experience for typescript #49297

Raynos opened this issue Aug 23, 2023 · 2 comments
Labels
feature request Issues that request new features to be added to Node.js.

Comments

@Raynos
Copy link
Contributor

Raynos commented Aug 23, 2023

What is the problem this feature will solve?

I want to take a cpu profile or flamegraph of my nodejs process where my application is written in typescript

What is the feature you are proposing to solve the problem?

Implement an optional cli flag that enables an experimental typescript ESM module loader.

I want nodejs to be able to start my application so that I’m not running ts-node or bob-esm instead.

by doing this I don’t have to fight with our existing tool chain which spawns node as a child process and thus makes it challenging and frustrating to attach the profiler or perf command to the child process.

What alternatives have you considered?

No response

@Raynos Raynos added the feature request Issues that request new features to be added to Node.js. label Aug 23, 2023
@bnoordhuis
Copy link
Member

Duplicate of - or at least very strongly related to - #43818. There's no consensus on how or if to move forward though.

@Raynos
Copy link
Contributor Author

Raynos commented Aug 23, 2023

For my own use case I actually realized that the third party library I am using is --loader compatible

So I was able to replace bob-tsm src/index.ts with node --loader=bob-tsm src/index.ts and that allowed me to cut out the child process and attach the profiler directly to node binary.

I think --loader=x is a very simple way of getting typescript support and was not really aware of it until now.

@Raynos Raynos closed this as completed Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js.
Projects
Status: Pending Triage
Development

No branches or pull requests

2 participants