nodejs / import-in-the-middle

Like `require-in-the-middle`, but for ESM import
https://www.npmjs.com/package/import-in-the-middle
Apache License 2.0
60 stars 22 forks source link

Support TypeScript extensions #13

Closed fardjad closed 2 years ago

fardjad commented 2 years ago

Expected Behavior

I have put together an example of chain-loading dd-trace and ts-node/esm in a native ESM project without compiling TS to JS here. However, to make it work, I had to patch import-in-the-middle.

Actual Behavior

Without the patch, MITM does not recognize TypeScript extensions (i.e. .ts, .mts, .cts).

Steps to Reproduce the Problem

  1. Clone the example repo
  2. Install the dependencies by running npm i --ignore-scripts
  3. Run npm test

Specifications