Skip to content

Conversation

@Timeless0911
Copy link
Contributor

@Timeless0911 Timeless0911 commented Dec 2, 2025

Summary

Fix edge cases of redirect.dts.extension when the folder and the file have same name.

Now we will check for existence of target path when redirect extension.

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings December 2, 2025 11:11
@netlify
Copy link

netlify bot commented Dec 2, 2025

Deploy Preview for rslib ready!

Name Link
🔨 Latest commit e9dcaad
🔍 Latest deploy log https://app.netlify.com/projects/rslib/deploys/692ec982df12c9000835a12b
😎 Deploy Preview https://deploy-preview-1374--rslib.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

Copilot finished reviewing on behalf of Timeless0911 December 2, 2025 11:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the DTS (TypeScript declaration) redirect functionality by checking for the existence of target paths before adding extensions to import statements. This prevents breaking imports for files that don't exist as TypeScript declarations (e.g., .svg files, type-only packages).

Key changes:

  • Refactored the addExtension function to verify target path existence before adding extensions
  • Added comprehensive test coverage for edge cases including directory imports and type-only packages
  • Updated documentation examples to use .ts config files instead of .js

Reviewed changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/plugin-dts/src/utils.ts Refactored addExtension function to check path existence before adding extensions, preventing broken imports
tests/integration/redirect/dts.test.ts Added test expectations for new config module and prebundle-types scenarios
tests/integration/redirect/dtsTsgo.test.ts Added test expectations for new config module and prebundle-types scenarios
tests/integration/redirect/dts/tsconfig.json Added prebundle-types path mapping for test coverage
tests/integration/redirect/dts/src/index.ts Added exports for new test modules (config, prebundle-types)
tests/integration/redirect/dts/src/config.ts New test file that re-exports from subdirectory
tests/integration/redirect/dts/src/config/load.ts New test file with loadConfig function
tests/integration/redirect/dts/compile/prebundle-types/ New test package with type-only declarations
tests/integration/redirect/dts-tsgo/ Similar test additions for tsgo variant
website/docs/en/config/lib/experiments.mdx Updated example config filename from .js to .ts
website/docs/zh/config/lib/experiments.mdx Updated example config filename from .js to .ts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Timeless0911 Timeless0911 merged commit 1fea10d into main Dec 2, 2025
18 checks passed
@Timeless0911 Timeless0911 deleted the redirect-dts-extension branch December 2, 2025 11:43
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.

3 participants