There is https://nodejs.org/api/packages.html#imports and resolvePackageJsonImports in tsconfig.json.
My configuration:
tsconfig.json:
package.json:
Running node --loader=@swc-node/register/esm main.ts results in:
node:internal/process/esm_loader:46
internalBinding('errors').triggerUncaughtException(
^
RangeError [ERR_UNKNOWN_MODULE_FORMAT]: Unknown module format: undefined for URL file:///home/foxpro/craft/sferadel/dev/api/eql/index.mts
at new NodeError (node:internal/errors:405:5)
at Object.throwUnknownModuleFormat (node:internal/modules/esm/load:155:9)
at Hooks.load (node:internal/modules/esm/hooks:417:44)
at async handleMessage (node:internal/modules/esm/worker:168:18) {
code: 'ERR_UNKNOWN_MODULE_FORMAT'
}
Node.js v20.5.1
I tried to change to:
"imports": {
"#eql": "./eql/index.mjs"
},
Then, error is
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/foxpro/craft/sferadel/dev/api/eql/index.mjs' imported from /home/foxpro/craft/sferadel/dev/api/user/user.mts
It's closed circle. Am I doing it in a wrong way?
There is https://nodejs.org/api/packages.html#imports and
resolvePackageJsonImportsintsconfig.json.My configuration:
tsconfig.json:
package.json:
Running
node --loader=@swc-node/register/esm main.tsresults in:I tried to change to:
Then, error is
It's closed circle. Am I doing it in a wrong way?