-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix(es/modules): Preserve extensions #6339
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swc-bump:
- dbg-swc
Pull request was converted to draft
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was workaround for ts, i.e.
import foo from "./test.ts"
to
import foo from "./test"
So test.js
can be resolved, not sure why it was implemented in this way 😕
babel keeps exetensions too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤣 I made lots of mistakes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automated review comment generated by auto-rebase script
Hey @kdy1! I just had to downgrade because of this change, for the exact reason I think you mentioned in your comment 😅 I have a NestJS project where none of my imports use extensions (as per NestJS convention) – however, now my TypeScript compile from this: import foo from './bar.module'; to import foo from './bar.module.ts'; even though SWC is generating a directory full of JavaScript files. My code crashes because it can't find Is there any workaround for this? Or am I stuck on 1.3.14 for now? |
Use |
You can fix your code. It's not a something to workaround. Your code is simply wrong. |
As I mentioned, .js imports get rewritten back to .ts anyway. I spent some time looking into this, and realized that as long as you have a The project is ESM, and with a This is a legitimate problem, regardless of how you're importing your modules. |
My bad, I misread your comment, sorry. Can you file an issue? |
Yep 👍🏻 |
Description:
Related issue: