Skip to content

Commit d5121fd

Browse files
committed
fix: prioritize via resolution path over generic roots
1 parent 2e36d54 commit d5121fd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/nuxi/src/utils/versions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function getPkgVersion(cwd: string, pkg: string, options?: { via?: string
2222

2323
export function getPkgJSON(cwd: string, pkg: string, options?: { via?: string }) {
2424
const roots = [cwd, tryResolveNuxt(cwd)].filter((v): v is string => !!v)
25-
const searchFrom = [...roots]
25+
const searchFrom: string[] = []
2626

2727
if (options?.via) {
2828
for (const from of roots) {
@@ -34,6 +34,8 @@ export function getPkgJSON(cwd: string, pkg: string, options?: { via?: string })
3434
}
3535
}
3636

37+
searchFrom.push(...roots)
38+
3739
for (const from of searchFrom) {
3840
const p = resolveModulePath(`${pkg}/package.json`, { from, try: true })
3941
if (p) {

0 commit comments

Comments
 (0)