From 6c3d16ebdb46c968de0d34c83bfeb13fc73976a2 Mon Sep 17 00:00:00 2001 From: Yuangwang Date: Tue, 19 Nov 2024 14:01:01 -0500 Subject: [PATCH] fix(firebase-app-hosting): use relative path in `runCommand` (#2895) Co-authored-by: Pooya Parsa --- src/presets/firebase/preset.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/presets/firebase/preset.ts b/src/presets/firebase/preset.ts index c741d71435..a7098a248e 100644 --- a/src/presets/firebase/preset.ts +++ b/src/presets/firebase/preset.ts @@ -1,6 +1,6 @@ import { defineNitroPreset, writeFile } from "nitropack/kit"; import { version as nitroVersion } from "nitropack/meta"; -import { basename, join } from "pathe"; +import { basename, join, relative } from "pathe"; import type { Plugin } from "rollup"; import { genSafeVariableName } from "knitwork"; import { stringifyYAML } from "confbox"; @@ -83,12 +83,13 @@ const firebaseAppHosting = defineNitroPreset( serveStatic: true, hooks: { async compiled(nitro) { + const serverEntry = join(nitro.options.output.serverDir, "index.mjs"); await writeFile( join(nitro.options.rootDir, ".apphosting/bundle.yaml"), stringifyYAML({ version: "v1", runConfig: { - runCommand: "node .output/server/index.mjs", + runCommand: `node ${relative(nitro.options.rootDir, serverEntry)}`, ...(nitro.options.firebase as AppHostingOptions)?.appHosting, }, metadata: {