From 5379d78bc94139b052d770d4471ee2ecb88b397f Mon Sep 17 00:00:00 2001 From: sonallux Date: Sat, 25 Nov 2023 13:10:04 +0100 Subject: [PATCH] Fix Angular SSR deployment on Windows fixes #6543 --- src/frameworks/angular/index.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/frameworks/angular/index.ts b/src/frameworks/angular/index.ts index 8afaea089bd1..3e069a378133 100644 --- a/src/frameworks/angular/index.ts +++ b/src/frameworks/angular/index.ts @@ -1,4 +1,4 @@ -import { join, posix } from "path"; +import { join, posix, sep } from "path"; import { execSync } from "child_process"; import { spawn, sync as spawnSync } from "cross-spawn"; import { copy, pathExists } from "fs-extra"; @@ -212,6 +212,7 @@ export async function ɵcodegenFunctionsDirectory( let bootstrapScript: string; if (browserLocales) { + const serverOutputPosixPath = serverOutputPath.split(sep).join(posix.sep); const locales = serverLocales?.filter((it) => browserLocales.includes(it)); bootstrapScript = `const localizedApps = new Map(); const ffi18n = import("firebase-frameworks/i18n"); @@ -227,8 +228,8 @@ exports.handle = function(req,res) { } else { ${ serverEntry?.endsWith(".mjs") - ? `import(\`./${serverOutputPath}/\${locale}/${serverEntry}\`)` - : `Promise.resolve(require(\`./${serverOutputPath}/\${locale}/${serverEntry}\`))` + ? `import(\`./${serverOutputPosixPath}/\${locale}/${serverEntry}\`)` + : `Promise.resolve(require(\`./${serverOutputPosixPath}/\${locale}/${serverEntry}\`))` }.then(server => { const app = server.app(locale); localizedApps.set(locale, app); @@ -238,10 +239,11 @@ exports.handle = function(req,res) { }); };\n`; } else if (serverOutputPath) { + const serverOutputPosixPath = serverOutputPath.split(sep).join(posix.sep); bootstrapScript = `const app = ${ serverEntry?.endsWith(".mjs") - ? `import(\`./${serverOutputPath}/${serverEntry}\`)` - : `Promise.resolve(require('./${serverOutputPath}/${serverEntry}'))` + ? `import(\`./${serverOutputPosixPath}/${serverEntry}\`)` + : `Promise.resolve(require('./${serverOutputPosixPath}/${serverEntry}'))` }.then(server => server.app()); exports.handle = (req,res) => app.then(it => it(req,res));\n`; } else {