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

Stops using realpath in the resolution #5975

Closed
wants to merge 1 commit into from

Conversation

arcanis
Copy link
Contributor

@arcanis arcanis commented Apr 12, 2018

Summary

The default resolver uses realpath to ensure that multiple identical paths always share the same underlying module. This is a behavior that should belong to the component instantiating the modules rather than the one resolving the paths.

One example of problem it could cause is when using yarn link with peer dependencies. In this case, it's important to preserve the symlinks as they are in order to properly resolve the peer dependencies relative to the location of the symlink rather than the one of the actual package on the filesystem.

Test plan

Existing tests should still pass.

@arcanis
Copy link
Contributor Author

arcanis commented Apr 12, 2018

cc @mjesun @cpojer

Copy link
Member

@cpojer cpojer 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. This now matches what node's resolution algorithm does by creating two instances, right?

A test that verifies the changed behavior would be good, otherwise we may break this again.

cc @gaearon who frequently brought this up

@gaearon
Copy link
Contributor

gaearon commented Apr 12, 2018

Here's two PRs related to realpath that I sent that were fixing issues:

I don't remember the context around those changes but as long as test cases I added pass I'm good.

@mjesun
Copy link
Contributor

mjesun commented Apr 12, 2018

Isn't this going to change all the logic for symlinks? The changed code won't dereference symlinks, so the comment above is not correct anymore.

I'm also not sure if this is something we'd change, it can have unexpected side effects.

@arcanis
Copy link
Contributor Author

arcanis commented Apr 12, 2018

Yeah, I'll retract this change, I have a better one.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants