Skip to content

fix: correct extension alias order to align with Node.js#4308

Merged
chenjiahan merged 1 commit intomainfrom
extension_alias_order_0101
Jan 1, 2025
Merged

fix: correct extension alias order to align with Node.js#4308
chenjiahan merged 1 commit intomainfrom
extension_alias_order_0101

Conversation

@chenjiahan
Copy link
Member

@chenjiahan chenjiahan commented Jan 1, 2025

Summary

When importing ./foo.js in a TypeScript file, if there are both foo.ts and foo.js, Node.js and TypeScript have different resolution orders:

  • TypeScript will resolve foo.ts first.
  • Node.js will resolve foo.js first.

Rsbuild should match the behavior of Node.js, because:

  1. It maintains consistency with Node.js runtime behavior, avoiding potential surprises when the code runs in production
  2. It follows the explicit intent when developers specifically write .js in their import statements

This PR fixes this issue from Discord:

image

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@netlify
Copy link

netlify bot commented Jan 1, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 01b88c5
🔍 Latest deploy log https://app.netlify.com/sites/rsbuild/deploys/6774cf9f2c5c3e0008d08c1d
😎 Deploy Preview https://deploy-preview-4308--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 73 (🔴 down 9 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@chenjiahan chenjiahan merged commit 3445b73 into main Jan 1, 2025
10 checks passed
@chenjiahan chenjiahan deleted the extension_alias_order_0101 branch January 1, 2025 05:30
@chenjiahan chenjiahan mentioned this pull request Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant