Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module when explicit import extension #1494

Closed
loynoir opened this issue Oct 9, 2021 · 2 comments
Closed

Cannot find module when explicit import extension #1494

loynoir opened this issue Oct 9, 2021 · 2 comments
Milestone

Comments

@loynoir
Copy link

loynoir commented Oct 9, 2021

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.ts
import b from './b.js'
console.log(b)
// b.ts
export default 42

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?:
@cspotcode cspotcode added this to the next milestone Feb 7, 2022
@cspotcode cspotcode linked a pull request Feb 7, 2022 that will close this issue
@cspotcode
Copy link
Collaborator

Will be resolved by #1361

@cspotcode cspotcode modified the milestones: 10.6.0 or 10.5.1, next Feb 21, 2022
@cspotcode
Copy link
Collaborator

Closing as implemented already in recent releases of ts-node. Depending on your project, you might need to enable experimentalResolver: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants