Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WIP] Destructuring re-exports using type from symlinked node-modules results in relative paths used inimport() type#1348

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Copilot wants to merge9 commits intomain
base:main
Choose a base branch
Loading
fromcopilot/fix-1347

Conversation

Copilot
Copy link
Contributor

@CopilotCopilotAI commentedJul 2, 2025
edited
Loading

  • Understand the issue: destructuring re-exports using type from symlinked node-modules results in relative paths used inimport() types instead of package names
  • Explore repository structure and build system
  • Create test case that reproduces the issue (destructuringReexportSymlinkImportType.ts)
  • Verify test case shows the problem:import("../../b/index.js").B instead ofimport("package-b").B
  • Investigate module specifier generation code ininternal/modulespecifiers/specifiers.go
  • Identify the issue: The condition incomputeModuleSpecifiers at line 381 is adding node_modules paths torelativeSpecifiers whentryGetModuleNameAsNodeModule fails to generate a proper package name
  • Debug whytryGetModuleNameAsNodeModule fails for symlinked packages
  • Implement fix to prefer package names over relative paths for symlinked packages
  • Verify fix works by running test and checking output
  • Run linting and other tests to ensure no regressions

Fixes#1347.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Clickhere to start the survey.

CopilotAIand others added2 commitsJuly 2, 2025 15:06
…node-modulesCo-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
@jakebailey
Copy link
Member

Try again

…o use package namesCo-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
@CopilotCopilot SWE Agent
Copy link
ContributorAuthor

CopilotAI commentedJul 2, 2025

Try again

I've successfully fixed the issue! The problem was thattryGetModuleNameAsNodeModule only worked for paths containing "node_modules", but symlinked packages use real paths without "node_modules". I modified the code to try generating module specifiers for all paths and added fallback logic to infer package names from package.json files when dealing with symlinked packages. The test now correctly showsimport("package-b").B instead ofimport("../../b/index.js").B. Commit:763e4d7

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot finished work on behalf ofjakebaileyJuly 2, 2025 16:18
@jakebailey
Copy link
Member

This is definitely wrong, restart and try again. Note that the originaltryGetModuleNameAsNodeModule (which you will find in_submodules/TypeScript) does not do anything like this. The fix must be something different.

@CopilotCopilot SWE Agent
Copy link
ContributorAuthor

CopilotAI commentedJul 8, 2025

This is definitely wrong, restart and try again. Note that the originaltryGetModuleNameAsNodeModule (which you will find in_submodules/TypeScript) does not do anything like this. The fix must be...

You're absolutely right. I've reverted my previous approach and am now implementing a proper fix. The issue is thatgetEachFileNameOfModule withpreferSymlinks: true should return both the real path AND symlink paths that point to it, but the Go implementation was only returning real paths. I've implemented a targeted fix that finds symlink paths in node_modules directories for symlinked packages, ensuring the module specifier generation can use package names instead of relative paths.

CopilotAIand others added2 commitsJuly 8, 2025 00:22
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
@jakebailey
Copy link
Member

Continue, you had an error while working

saadazghour and jansedlon reacted with laugh emoji

@CopilotCopilot SWE Agent
Copy link
ContributorAuthor

CopilotAI commentedJul 8, 2025

Continue, you had an error while working

Continuing with the implementation. The issue is that the symlink resolution logic ingetEachFileNameOfModule is incomplete - the TypeScript equivalent uses a symlink cache to find alternate paths, but this isn't implemented in the Go code. Working on implementing the missing symlink directory handling.

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@697549975669754997566975499756 approved these changes

@jakebaileyjakebaileyAwaiting requested review from jakebailey

At least 1 approving review is required to merge this pull request.

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Destructuring re-exports using type from symlinked node-modules results in relative paths used inimport() type
3 participants
@Copilot@jakebailey@6975499756

[8]ページ先頭

©2009-2025 Movatter.jp