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

Resolve .tsx files from .js extensions #33

Closed
wants to merge 3 commits into from
Closed

Resolve .tsx files from .js extensions #33

wants to merge 3 commits into from

Conversation

karlhorky
Copy link

src/loader.ts Outdated Show resolved Hide resolved
Co-authored-by: Luke Edwards <[email protected]>
@lukeed
Copy link
Owner

lukeed commented Mar 25, 2022

TypeScript doesn't allow imports to *.jsx files right?

src/loader.ts Outdated Show resolved Hide resolved
@karlhorky
Copy link
Author

karlhorky commented Mar 25, 2022

tsc allows both:

  • .jsx to resolve .tsx
  • .jsx to resolve .ts

edit: oh wait, did you mean .js resolving to .jsx? ...that doesn't work.

@karlhorky
Copy link
Author

Should we add the other transforms for .jsx import paths too?

@lukeed
Copy link
Owner

lukeed commented Mar 25, 2022

No @ jsx updates – that's ridiculous

Please check out the CI results for the test-tsx branch – it replicates your original issue and yet the jsx and tsx files are loaded correctly regardless of the sourcefile's extension and ESM-vs-CJS format.

Edit: It doesn't replicate your issue at all 🙈 lol 😴

@lukeed
Copy link
Owner

lukeed commented Mar 25, 2022

Can you actually send over a reproduction using ts-node? I can get tsc to not throw errors, but ts-node never actually works or applies any of the resolutions described here or in my updated test files

@karlhorky
Copy link
Author

karlhorky commented Mar 25, 2022

Can you actually send over a reproduction using ts-node?

Sure, here's a Replit: https://replit.com/@karlhorky/SuperbLivelyEditor#index.ts

The start script runs ts-node-esm index.ts

Screen Shot 2022-03-25 at 19 00 17

@karlhorky
Copy link
Author

@lukeed just circling back around to this since I noticed a new version of tsm was released.

What do you think about getting a fix in for the inconsistency with the .js fully-specified ESM import paths?

@karlhorky
Copy link
Author

karlhorky commented Oct 9, 2022

Did some more research on what tsc and esbuild supports for extensions over here, also including the latest nodenext options in tsconfig.json:

privatenumber/tsx#112 (comment)

@karlhorky
Copy link
Author

Nice, [email protected] (PR #43) is working, thanks! 🙌

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 this pull request may close these issues.

2 participants