Skip to content

Conversation

@kricsleo
Copy link
Member

πŸ”— Linked issue

resolves #3034

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR automatically adds package aliases from package.json for tracing, so the final bundle can correctly link these dependencies.

For example:

"dependencies": {
  "@std/ulid": "npm:@jsr/[email protected]",
  "lodash4": "npm:[email protected]"
}

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

return null;
}

const parts = version.split(":")[1]!.split("@");
Copy link
Member

Choose a reason for hiding this comment

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

This is not a reliable way.

  • Aliases can be done using resolutions, overrides, or aliases like this
  • Rules can also be from workspace settings
  • Package aliases can happen at any nested level and are respected by package managers.

Copy link
Member Author

Choose a reason for hiding this comment

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

I see, then what about adding package aliases here:

// Normally package name should be same as originalId
// Edge cases: Subpath export and full paths
if (pkgName !== originalId) {

If the imported package name doesn't match the resolved package name (also considering "Subpath export and full paths"), then there might be a package alias. We could automatically add this alias to traceAlias. How does that sound? πŸ€”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nitro does not transpile libraries from external registry (JSR)

2 participants