Skip to content

Cannot find module when explicit import extension #1494

Description

@loynoir

Search Terms

Why explicit extension

Explicit import extension seems the ONLY convenient way to write dual module in typescript, supported by tsc.

Expected Behavior

$ ts-node a.ts
42

Actual Behavior

$ ts-node a.ts
Error: Cannot find module './b.js'

Steps to reproduce the problem

Minimal reproduction

// a.tsimportbfrom'./b.js'console.log(b)
// b.tsexportdefault42

Specifications

  • ts-node version:
  • node version:
  • TypeScript version:
  • tsconfig.json, if you're using one:
{}
  • Operating system and version:
  • If Windows, are you using WSL or WSL2?:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions