Closed tcollinsworth closed 2 years ago
I just spent the whole morning debugging TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/bhunt/.../test/basics.spec.ts
and the root cause was using p-queue v7.x in the code I was trying to test. The code compiled just fine, but failed with the above error when running mocha with ts-node.
Just noting: I've encountered the exact same thing @BryanHunt describes above.
Is there any solution available to us? I've been digging into esm / ts-node stuff and haven't found anything useful yet.
For now I'm downgrading to ^6.0.0
I just hit a similar issue, when upgrading from 6.6.2 to 7.x my -r esm
-based project gets MODULE_NOT_FOUND
. strace
-ing and node
isn't looking for dist/index.js
but only index.js
(and a ton of other files).
+
ESM support is up to tooling to cover. See https://github.com/sindresorhus/p-queue/issues/144
For example sinon mocking and newrelic agents have no workaround. Please consider keeping it esm but not native esm. Just drop the package.json type: module and don't use .mjs extensions. Then developers can still use the library as an esm module with all the goodness but without the code being locked from manipulation by mocks and instrumenting monitoring agents. And it doesn't force them to update their projects to native modules. And if someone knows different, please enlighten me.
After lots of pain updating my own libraries, I backed them all out of native esm for these very same reasons.