Skip to content

Importing ts file with .js specifier from .mjs in another workspace fails #334

@webpro

Description

@webpro

Environment

Node.js v20, both jiti v1 + v2

Reproduction

Please see https://stackblitz.com/edit/stackblitz-starters-zwqrgl?file=playwright.config.mjs

npx jiti playwright.config.mjs 

Issue happens in both jiti v1 and v2. Cannot find module, but should print { hello: 1 }

First I'd like to know if you think this should even work. If so, I'm happy to look into fix & send PR.

Describe the bug

Not sure if this is even supposed to work: import with .js extensions in specifier which is actually a .ts file and in a workspace dir with type: "module". Relevant bits (minimized in repro):

Apparently Playwright's using something that's able to load it all up.

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions