Skip to content
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(node-resolve): pass original importee to secondary resolve #1557

Merged
merged 6 commits into from
Aug 17, 2023

Conversation

jchip
Copy link
Contributor

@jchip jchip commented Aug 10, 2023

Rollup Plugin Name: node-resolve

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:

Description

pass on original importee to other plugins.

@jchip jchip requested a review from tjenkinson as a code owner August 10, 2023 21:51
@shellscape
Copy link
Collaborator

Thanks for the PR. Could you please provide a much more detailed explanation on what this PR is adding, solving, or fixing for you, with examples?

@jchip
Copy link
Contributor Author

jchip commented Aug 11, 2023

@shellscape We want to build plugins as part of our dev tools to offer module analytics and stats. One use case is exploring a different approach to implementing module federation on rollup. For that, at our plugin, we need two pieces of information:

  1. The original import specifier from the code that does the import, like import "react".
  2. The actual full path to the module that "react" resolved to, which node-resolve provided.

Having the information in 1 and 2 above at the same time in a plugin is crucial to implement some of the tooling aspect we are exploring. So the changes in this PR updates node-resolve to pass them both to further plugins as it does its second resolve.

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

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

Looks good to me and might indeed be useful. The only thing I hope is that we can use this chance to document this feature (and the "resolved" feature) in the Readme so that people know about it, can you do that?

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

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

Thanks a lot, looks good!

@shellscape shellscape merged commit 9b9da3a into rollup:master Aug 17, 2023
7 checks passed
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.

None yet

3 participants