-
Notifications
You must be signed in to change notification settings - Fork 309
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
Make it possible to use dd-trace-js together with a Typescript ESM loader #2190
Comments
I opened nodejs/import-in-the-middle#16 to try and merge your test project and the extension fix as a single PR, but I wasn't able to make it work. Do you know what could cause the error here? I'm not familiar at all with |
I think I don't have access to see the logs of the workflows, but I rebased my fork on your branch and updated the PR. It should be working now. |
Perfect, thanks for the quick fix. Do you know why it's a problem if |
No problem! According to the official Node.js docs, if we do After refreshing my memory on how loaders work, I realized that my previous comment was not accurate and while it's related, it doesn't have much to do with
The custom loader fixes this issue by composing |
Sounds like this could be handled better in iitm. In any case, now that the new plugin system landed in dd-trace, it's very likely we'll end up with a custom internal loader instead which shouldn't have this type of issue in the following months. |
Thanks to (experimental) support for loaders in Node.js, it's relatively easy to run Typescript without a pre-compilation step in ESM projects. That simplifies the build process and improves the developer experience.
However, it's still hard to get the ESM loader used by dd-trace-js (import-in-the-middle) to play nice with a Typescript ESM loader such as ts-node.
I reported an issue here about two weeks ago, but I did not receive any acknowledgment/feedback/input from Datadog whatsoever. As we are planning to migrate our Node.js repositories to ESM, and we would like to keep the possibility of running our TS projects without a build step, I thought it's best to raise this here again in a more generic manner.
The text was updated successfully, but these errors were encountered: