Skip to content

Commit

Permalink
fix: resolve nuxt directory from rootDir
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Sep 25, 2024
1 parent f9714f2 commit 1518e46
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const loadKit = async (
// Without PNP (or if users have a local install of kit, we bypass resolving from Nuxt)
const localKit = await tryResolveModule('@nuxt/kit', rootDir)
// Otherwise, we resolve Nuxt _first_ as it is Nuxt's kit dependency that will be used
const rootURL = localKit ? rootDir : (await tryResolveNuxt()) || rootDir
const rootURL = localKit ? rootDir : (await tryResolveNuxt(rootDir)) || rootDir
let kit: typeof import('@nuxt/kit') = await importModule(
'@nuxt/kit',
rootURL,
Expand All @@ -30,9 +30,9 @@ export const loadKit = async (
}
}

async function tryResolveNuxt() {
async function tryResolveNuxt(rootDir: string) {
for (const pkg of ['nuxt-nightly', 'nuxt3', 'nuxt', 'nuxt-edge']) {
const path = await tryResolveModule(pkg)
const path = await tryResolveModule(pkg, rootDir)
if (path) {
return path
}
Expand Down

0 comments on commit 1518e46

Please sign in to comment.