You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assume I have test.js, I can run node --import ./test1.js well.
But node --import @swc-node/register/esm-register --import ./test1.js fail:
node:internal/modules/run_main:129
triggerUncaughtException(
^
Error: All of the aliased extensions are not found for /hax/test1.js: ./test1.js cannot be resolved in file:///hax/x/
at resolve (file:///hax/x/node_modules/@swc-node/register/esm/esm.mjs:157:15)
at async nextResolve (node:internal/modules/esm/hooks:866:22)
at async Hooks.resolve (node:internal/modules/esm/hooks:304:24)
at async MessagePort.handleMessage (node:internal/modules/esm/worker:196:18)
Node.js v20.16.0
I notice the dir seems become parent dir, and found that node --import @swc-node/register/esm-register/esm-register --import ./x/test1.js works.
Note, version 1.10.0 is ok (though not support --import ./test.ts). It seems become broken from 1.10.1 .
The text was updated successfully, but these errors were encountered:
hax
changed the title
swc-node/register resolve to wrong path
swc-node/register make follow-on --import resolve to wrong path
Aug 22, 2024
I am getting this same error when attempting to import bignumber.js using swc-node/register/esm which I wasn't seeing previously utilizing ts-node. I've created a repo that reproduces the issue here:
It seems like it may be related to it needing to be in a yarn workspace as I wasn't able to reproduce the issue without the yarn workspace hoisting involved:
Error: All of the aliased extensions are not found for /.../swc-import-bug/package/node_modules/bignumber.js: bignumber.js cannot be resolved in file:///.../swc-import-bug/package/src/index.ts
at resolve (file:///.../swc-import-bug/node_modules/@swc-node/register/esm/esm.mjs:157:15)
at async nextResolve (node:internal/modules/esm/hooks:865:22)
at async Hooks.resolve (node:internal/modules/esm/hooks:303:24)
at async MessagePort.handleMessage (node:internal/modules/esm/worker:196:18)
Assume I have
test.js
, I can runnode --import ./test1.js
well.But
node --import @swc-node/register/esm-register --import ./test1.js
fail:I notice the dir seems become parent dir, and found that
node --import @swc-node/register/esm-register/esm-register --import ./x/test1.js
works.Note, version 1.10.0 is ok (though not support
--import ./test.ts
). It seems become broken from 1.10.1 .The text was updated successfully, but these errors were encountered: