From 6eacad03b8700424889381644fe02dd383150495 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sat, 27 May 2023 11:24:21 -0500 Subject: [PATCH] fix(nuxt): resolve modules relative to modulesDir (#21082) --- packages/nuxt/src/core/app.ts | 2 +- packages/nuxt/src/core/nuxt.ts | 2 +- packages/nuxt/src/head/module.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nuxt/src/core/app.ts b/packages/nuxt/src/core/app.ts index 38bef2b1cc..9300e2275d 100644 --- a/packages/nuxt/src/core/app.ts +++ b/packages/nuxt/src/core/app.ts @@ -68,7 +68,7 @@ export async function resolveApp (nuxt: Nuxt, app: NuxtApp) { ) } if (!app.mainComponent) { - app.mainComponent = (await tryResolveModule('@nuxt/ui-templates/templates/welcome.vue'))! + app.mainComponent = (await tryResolveModule('@nuxt/ui-templates/templates/welcome.vue', nuxt.options.modulesDir))! } // Resolve root component diff --git a/packages/nuxt/src/core/nuxt.ts b/packages/nuxt/src/core/nuxt.ts index eb3647e0f9..16842c0f5f 100644 --- a/packages/nuxt/src/core/nuxt.ts +++ b/packages/nuxt/src/core/nuxt.ts @@ -190,7 +190,7 @@ async function initNuxt (nuxt: Nuxt) { addComponent({ name: 'NuxtWelcome', priority: 10, // built-in that we do not expect the user to override - filePath: (await tryResolveModule('@nuxt/ui-templates/templates/welcome.vue'))! + filePath: (await tryResolveModule('@nuxt/ui-templates/templates/welcome.vue', nuxt.options.modulesDir))! }) addComponent({ diff --git a/packages/nuxt/src/head/module.ts b/packages/nuxt/src/head/module.ts index 47ced53abb..fa8f83118d 100644 --- a/packages/nuxt/src/head/module.ts +++ b/packages/nuxt/src/head/module.ts @@ -50,7 +50,7 @@ export default defineNuxtModule({ // Opt-out feature allowing dependencies using @vueuse/head to work if (nuxt.options.experimental.polyfillVueUseHead) { // backwards compatibility - nuxt.options.alias['@vueuse/head'] = await tryResolveModule('@unhead/vue') || '@unhead/vue' + nuxt.options.alias['@vueuse/head'] = await tryResolveModule('@unhead/vue', nuxt.options.modulesDir) || '@unhead/vue' addPlugin({ src: resolve(runtimeDir, 'plugins/vueuse-head-polyfill') }) }