Hi folks. I've got a question regarding how ts-node internally transpiles TypeScript during execution.
I've got the following code in a .ts script:
import { publicKeyVerify } from "secp256k1"
Transpiling this code using tsc works normally. However, running ts-node (via node -t ts-node/register --loader ts-node/esm and other such incantations) does not work -- it gives me an error:
The requested module 'secp256k1' is a CommonJS module, which may not support all module.exports as named exports.
I understand how to fix this -- by doing an import such as:
import secp256k1 from "secp256k1"
const { publicKeyVerify } = secp256k1
My question is: why does tsc work perfectly fine, and ts-node does not, given that (from what I gather) ts-node uses tsc internally as a transpiler?
It kinda bothers me the fact that both tools do not agree on what syntax is necessary, when I would suppose they should -- after all, ts-node transpiles using the same exact compiler and same exact configuration.
I've also posted a question to StackOverflow, in case anyone is interested on answering there: https://stackoverflow.com/q/79895491/259543
Any help is appreciated!