From 91685a5b2bef68d1b160b4dd002d8194c8d402d3 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 10 Jun 2024 20:49:43 +0100 Subject: [PATCH] fix(nuxt): resolve full path to app manifest stub page --- packages/nuxt/src/pages/module.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/nuxt/src/pages/module.ts b/packages/nuxt/src/pages/module.ts index ae80fd4e02..3e5982ea3b 100644 --- a/packages/nuxt/src/pages/module.ts +++ b/packages/nuxt/src/pages/module.ts @@ -1,6 +1,6 @@ import { existsSync, readdirSync } from 'node:fs' import { mkdir, readFile } from 'node:fs/promises' -import { addBuildPlugin, addComponent, addPlugin, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, defineNuxtModule, findPath, logger, updateTemplates, useNitro } from '@nuxt/kit' +import { addBuildPlugin, addComponent, addPlugin, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, defineNuxtModule, findPath, logger, resolvePath, updateTemplates, useNitro } from '@nuxt/kit' import { dirname, join, relative, resolve } from 'pathe' import { genImport, genObjectFromRawEntries, genString } from 'knitwork' import type { Nuxt, NuxtApp, NuxtPage } from 'nuxt/schema' @@ -344,6 +344,7 @@ export default defineNuxtModule({ } if (nuxt.options.experimental.appManifest) { + const componentStubPath = await resolvePath(resolve(runtimeDir, 'component-stub')) // Add all redirect paths as valid routes to router; we will handle these in a client-side middleware // when the app manifest is enabled. nuxt.hook('pages:extend', (routes) => { @@ -358,7 +359,7 @@ export default defineNuxtModule({ routes.push({ _sync: true, path: path.replace(/\/[^/]*\*\*/, '/:pathMatch(.*)'), - file: resolve(runtimeDir, 'component-stub'), + file: componentStubPath, }) } })