Skip to content

fix: require.resolve to correct sub node_modules#3003

Merged
antfu merged 1 commit intovitejs:mainfrom
zhangyuang:main
Apr 17, 2021
Merged

fix: require.resolve to correct sub node_modules#3003
antfu merged 1 commit intovitejs:mainfrom
zhangyuang:main

Conversation

@zhangyuang
Copy link
Contributor

Description

for the issue

when the same module for example path-to-regexp has different version in repo, prebundle will be error.

$ npm ls path-to-regexp
vite-react-tailwind-starter@0.0.0 /Users/zhangyuang/Desktop/vite-react-tailwind-starter
├── path-to-regexp@6.2.0
└─┬ react-router@5.2.0
  └── path-to-regexp@1.8.0

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@Shinigami92 Shinigami92 added the p3-minor-bug An edge case that only affects very specific usage (priority) label Apr 15, 2021
@zhangyuang
Copy link
Contributor Author

Excuse me @Shinigami92 when the PR can be checked and merged? My framework which used by vite need the bugfix

@Shinigami92 Shinigami92 requested review from antfu and patak-cat April 17, 2021 16:53
@patak-cat
Copy link
Member

Thanks for the PR @zhangyuang, LGTM. Others in the team need to review it to merge it now. There are a lot of PRs and issues due to the explosion in usage of Vite. To avoid being unlocked you can use something like https://www.npmjs.com/package/patch-package to patch your Vite version until this fix is released.

@Shinigami92
Copy link
Member

@zhangyuang Yeah, I'm sorry I'm currently unable to review your PR now
I'm currently involved in some other tasks

Hopefully antfu or I can get into a review the next few days
But we already have so many new PRs in Vite that this may land in the release after 2.2.0 of package vite
IMO that is such a great thing but sad for your PR 😅, I hope you will understand

@antfu antfu changed the title feat: use require.resolve options.paths to get the correct node_modul… fix: require.resolve to correct sub node_modules Apr 17, 2021
@antfu antfu merged commit da11d43 into vitejs:main Apr 17, 2021
TobiasMelen pushed a commit to TobiasMelen/vite that referenced this pull request May 3, 2021
Yelmor added a commit to Yelmor/vite that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p3-minor-bug An edge case that only affects very specific usage (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bugs: when the same module has different version in repo, prebundle will be error.

4 participants