Skip to content

Commit 1cc4410

Browse files
committed
Fix Angular SSR deployment on Windows
fixes #6543
1 parent 721c330 commit 1cc4410

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/frameworks/angular/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { join, posix } from "path";
1+
import { join, posix, sep } from "path";
22
import { execSync } from "child_process";
33
import { spawn, sync as spawnSync } from "cross-spawn";
44
import { copy, pathExists } from "fs-extra";
@@ -212,6 +212,7 @@ export async function ɵcodegenFunctionsDirectory(
212212

213213
let bootstrapScript: string;
214214
if (browserLocales) {
215+
const serverOutputPosixPath = serverOutputPath.split(sep).join(posix.sep);
215216
const locales = serverLocales?.filter((it) => browserLocales.includes(it));
216217
bootstrapScript = `const localizedApps = new Map();
217218
const ffi18n = import("firebase-frameworks/i18n");
@@ -227,8 +228,8 @@ exports.handle = function(req,res) {
227228
} else {
228229
${
229230
serverEntry?.endsWith(".mjs")
230-
? `import(\`./${serverOutputPath}/\${locale}/${serverEntry}\`)`
231-
: `Promise.resolve(require(\`./${serverOutputPath}/\${locale}/${serverEntry}\`))`
231+
? `import(\`./${serverOutputPosixPath}/\${locale}/${serverEntry}\`)`
232+
: `Promise.resolve(require(\`./${serverOutputPosixPath}/\${locale}/${serverEntry}\`))`
232233
}.then(server => {
233234
const app = server.app(locale);
234235
localizedApps.set(locale, app);
@@ -238,10 +239,11 @@ exports.handle = function(req,res) {
238239
});
239240
};\n`;
240241
} else if (serverOutputPath) {
242+
const serverOutputPosixPath = serverOutputPath.split(sep).join(posix.sep);
241243
bootstrapScript = `const app = ${
242244
serverEntry?.endsWith(".mjs")
243-
? `import(\`./${serverOutputPath}/${serverEntry}\`)`
244-
: `Promise.resolve(require('./${serverOutputPath}/${serverEntry}'))`
245+
? `import(\`./${serverOutputPosixPath}/${serverEntry}\`)`
246+
: `Promise.resolve(require('./${serverOutputPosixPath}/${serverEntry}'))`
245247
}.then(server => server.app());
246248
exports.handle = (req,res) => app.then(it => it(req,res));\n`;
247249
} else {

0 commit comments

Comments
 (0)