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

Dependency Conflicts in Monorepo: Errors Retrieving Dependencies #259

Closed
wkeylin opened this issue Jun 7, 2024 · 1 comment
Closed

Dependency Conflicts in Monorepo: Errors Retrieving Dependencies #259

wkeylin opened this issue Jun 7, 2024 · 1 comment

Comments

@wkeylin
Copy link

wkeylin commented Jun 7, 2024

Environment

node22

Reproduction

https://github.com/wkeylin/mlly-demo

Describe the bug

In a monorepo setup, if both the subdirectory and the parent directory have the same dependency, retrieving the dependency from package.json can cause errors.

├── node_modules
│   └── vue -> .pnpm/vue@2.7.16/node_modules/vue #vue@2.7 in the root directory
├── package.json
├── packages
│   └── test
│       ├── index.js
│       ├── node_modules
│       │   └── vue -> ../../../node_modules/.pnpm/vue@3.2.47/node_modules/vue #vue@3 in the subdirectory
│       └── package.json
├── pnpm-lock.yaml
└── pnpm-workspace.yaml
// packages/test/index.js

import { resolvePathSync } from 'mlly'
import process from 'node:process'

console.log('current dir', process.cwd())
const url = resolvePathSync('vue/package.json', {
  url: process.cwd()
})

console.log('resolved url', url) // The output URL points to the dependency path in the parent directory(vue@2.7)

Additional context

No response

Logs

No response

@wkeylin
Copy link
Author

wkeylin commented Jun 7, 2024

#158 closed

@wkeylin wkeylin closed this as completed Jun 7, 2024
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

No branches or pull requests

1 participant