fix(nuxt): resolve modules relative to modulesDir (#21082)

This commit is contained in:
Daniel Roe 2023-05-27 11:24:21 -05:00 committed by GitHub
parent 92bc999d0e
commit 6eacad03b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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({

View File

@ -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') })
}