Skip to content

Wrong root(cwd) determination for esm modules #1881

@ThePlenkov

Description

@ThePlenkov

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
image

And here is the base path ts-node is trying to resolve workspace.json against to.

image

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions