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

Rewrite .ts imports to .js imports (for native Node.js TypeScript support) #9611

Open
alshdavid opened this issue Oct 3, 2024 · 1 comment

Comments

@alshdavid
Copy link

Describe the feature

Nodejs have added experimental support for TypeScript however it requires imports with .ts extensions.

import foo from './foo.ts'

The TypeScript team have landed on this solution to add support:

microsoft/TypeScript#59597
microsoft/TypeScript#59767

Would be great if swc offered a similar solution

Babel plugin or link to the feature description

No response

Additional context

No response

@albertodiazdorado
Copy link

@alshdavid do you know if there is any work in this direction?

Since Nodejs uses swc for type stripping, I had assumed that rewriting relative import file extensions already worked out of the box in swc. Turns out it does not?

kdy1 pushed a commit to swc-project/pkgs that referenced this issue Feb 25, 2025
will closes swc-project/swc#9800

It seems that swc doesn't rewrite relative import extensions:
swc-project/swc#9611, so I think this is a
safe change. If I'm missing something please tell me and I will do
corresponding changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants
@alshdavid @albertodiazdorado and others