Skip to content

fix: get two different copies of the same module#7845

Closed
Bigfish8 wants to merge 1 commit intovitejs:mainfrom
Bigfish8:dedupe
Closed

fix: get two different copies of the same module#7845
Bigfish8 wants to merge 1 commit intovitejs:mainfrom
Bigfish8:dedupe

Conversation

@Bigfish8
Copy link
Contributor

fix #7621, #2503

Additional context

Because of the hash query, bare import and fs import from node_modules for same module will get the different result.
Use Map to dedupe.

The case in #7621 and #2503 works well in the PR.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@meteorlxy
Copy link
Contributor

I'm afraid that the issue is still not totally solved. I could still get different copies in my project (in a more complex scenario)

I'll try to provide another repro later 🤔

@meteorlxy
Copy link
Contributor

meteorlxy commented Aug 17, 2022

@Bigfish8 Hi, I tested your fix on Vite 3 and could still repro the issue on another case - importing from a sub directory in a bare imports. I've updated the original reproduce repo.

@meteorlxy
Copy link
Contributor

meteorlxy commented Aug 17, 2022

Alright, I got the point. I think we should cache the final resolved url instead of the resolved.id

@sapphi-red
Copy link
Member

Closing as this is fixed by #9848 via #9730.

@sapphi-red sapphi-red closed this Oct 17, 2022
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.

[Bug report] importing dependencies by fs paths results in two different copies of the same module (Same as #2503)

3 participants