Wrong root(cwd) determination for esm modules #1884
ThePlenkov
started this conversation in
General
Replies: 2 comments
-
it's important - I run the command from the root |
Beta Was this translation helpful? Give feedback.
0 replies
-
So current workaround instead of import to use dynamic import:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! During debug I have noticed something interesting. To use top-level await I've changed package to module and activated esm for ts-node. However right after this import for json files stopped working.

Here is what I have in IDE
And here is the base path ts-node is trying to resolve workspace.json against to.
I think you should take root path from tsconfig to resolve imports, same as typescript does. Otherwise is different logic
For now I'd prefer not to use ts-node with esm: true.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions