I was playing with the latest and greatest and notice that when running via:
node --import @swc-node/register/esm-register src/index.ts
… tsconfig.json path aliases are not recognised, e.g.
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
},
}
minimal reproducible example
Stack trace
node:internal/process/esm_loader:34
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/src/common' imported from /Users/myles/dev/issue-swc-node-1/src/index.ts
at finalizeResolution (node:internal/modules/esm/resolve:264:11)
at moduleResolve (node:internal/modules/esm/resolve:917:10)
at defaultResolve (node:internal/modules/esm/resolve:1130:11)
at nextResolve (node:internal/modules/esm/hooks:865:28)
at resolve (file:///Users/myles/dev/issue-swc-node-1/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]/node_modules/@swc-node/register/esm/esm.mjs:44:12)
at nextResolve (node:internal/modules/esm/hooks:865:28)
at Hooks.resolve (node:internal/modules/esm/hooks:303:30)
at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:826:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28) {
code: 'ERR_MODULE_NOT_FOUND',
url: 'file:///src/common'
}
Also of note: I am aware that native ESM would typically expect file-extensions to be specified in the import, but including them doesn't help in this case - though I think the expectation of swc would be not to care either way?
I was playing with the latest and greatest and notice that when running via:
…
tsconfig.jsonpath aliases are not recognised, e.g.{ "compilerOptions": { "paths": { "@/*": ["./src/*"] } }, }minimal reproducible example
Stack trace