We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package.json
There is https://nodejs.org/api/packages.html#imports and resolvePackageJsonImports in tsconfig.json. My configuration:
resolvePackageJsonImports
tsconfig.json
import eql from '#eql'
tsconfig.json:
"compilerOptions": { "strict": true, "baseUrl": ".", "target": "ESNext", "module": "NodeNext", "moduleResolution": "NodeNext", "resolvePackageJsonImports": true, "noEmit": true, "isolatedModules": true, "skipDefaultLibCheck": true, "skipLibCheck": true, }, // ...
package.json:
"type": "module", "imports": { "#eql": "./eql/index.mts" }, // ...
Running node --loader=@swc-node/register/esm main.ts results in:
node --loader=@swc-node/register/esm main.ts
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?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
There is https://nodejs.org/api/packages.html#imports and
resolvePackageJsonImports
intsconfig.json
.My configuration:
tsconfig.json:
package.json:
Running
node --loader=@swc-node/register/esm main.ts
results in:I tried to change to:
Then, error is
It's closed circle. Am I doing it in a wrong way?
The text was updated successfully, but these errors were encountered: