swc-node
swc-node copied to clipboard
Does not work with "type": "module" in package.json
node -r @swc-node/register index.ts seems to work, but only if "type": "module" isn't in package.json. I would give more details, but I don't know what the problem is myself.
Have you tried change module field in tsconfig.json to esnext?
I have the same issue. And it also reproduces with module: esnext in tsconfig.json.
Related ts-node issue, might have more info https://github.com/TypeStrong/ts-node/issues/1007
might need a --loader swc-node/esm?
ts-node added swc support, and supports node ESM using a loader.
However, I have yet to find some way to get Jest tests running with native node ESM, which neither @swc/jest nor ts-node seem to cover...