Skip to content

Commit 9b656bc

Browse files
authored
fix: resolve @unhead/vue from module and catch if fails (#417)
1 parent 5198b39 commit 9b656bc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ export default defineNuxtModule<ModuleOptions>({
116116
return
117117
}
118118
// couldn't be found for some reason, assume compatibility
119-
const { version: unheadVersion } = await readPackageJSON('@unhead/vue')
119+
const { version: unheadVersion } = await readPackageJSON('@unhead/vue', {
120+
from: nuxt.options.modulesDir,
121+
}).catch(() => ({ version: null }))
120122
if (unheadVersion?.startsWith('1')) {
121123
logger.error(`Nuxt Scripts requires Unhead >= 2, you are using v${unheadVersion}. Please run \`nuxi upgrade --clean\` to upgrade...`)
122124
}

0 commit comments

Comments
 (0)