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

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

Closed
zhangyuang opened this issue Apr 13, 2021 · 1 comment · Fixed by #3003
Closed

Comments

@zhangyuang
Copy link
Contributor

Describe the bug

when the same module has different version in repo, prebundle will be error.
for example, react-router depend on [email protected] , repo depend on the latest [email protected]
when prebund react-router will use root directory node_modules module which is [email protected] will cause import error。because [email protected] has different export from [email protected]

$ 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

image

may be when !isEntry , here can use the module itself node_modules rather than root directory node_modules

 function resolveEntry(id: string, isEntry: boolean) {
        const flatId = flattenId(id)
        if (flatId in qualified) {
          return isEntry
            ? {
                path: flatId,
                namespace: 'dep'
              }
            : {
                path: path.resolve(qualified[flatId])
              }
        }
      }

Reproduction

https://github.com/zhangyuang/vite-prebundle-error

$ npm i && npm run dev
@zhangyuang
Copy link
Contributor Author

i provide a pr maybe can fix the problem。trouble @antfu @underfin to check it

@Shinigami92 Shinigami92 linked a pull request Apr 15, 2021 that will close this issue
4 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants