-
Notifications
You must be signed in to change notification settings - Fork 142
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
feat: allow to import TS files with js extension #3536
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
if (tsconfigPath) { | ||
// TypeScript allows importing TS files with `.js` extension | ||
chain.resolve.extensionAlias.merge({ | ||
'.js': ['.ts', '.tsx', '.js'], |
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.
Should we also add '.jsx': ['.jsx', '.tsx']
as the default extensionAlias
?
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.
Agree, we can add '.jsx': ['.tsx', '.jsx']
to align with TypeScript. TS resolves .tsx
first.
@chenjiahan did you consider NPM repos that are called Interestingly, on our CI, for 1.0.6 we are seeing failures importing
Error
|
Might be a bug of Rspack resolver, @SoonIter can you help to check it? |
@joesaunderson This error only appears when |
Hmm not sure, this was working fine on 1.0.5, but for a Dependabot change, where nothing else changes other than 1.0.6, it fails. It was also failing for 'tippy.js" which makes me think it's a bug, not a failure to install? I see an issue has been created, does that mean you can now replicate this? |
No, the issue is about improving the error logs. If you can provide a reproduction, that would be very helpful. |
I can replicate with just this minimal config: Config:
TSConfig:
File (
Error:
|
@SoonIter you can help to check ⬆️ |
This reverts commit 880d337.
@chenjiahan I can confirm that on 1.0.7 this is now working, so your changes above (the revert) fixed that. Thanks. |
Summary
Allow to import TS files with
.js
extension, align the default behavior with TypeScript.Related Links
Checklist