1
- import { join , posix } from "path" ;
1
+ import { join , posix , sep } from "path" ;
2
2
import { execSync } from "child_process" ;
3
3
import { spawn , sync as spawnSync } from "cross-spawn" ;
4
4
import { copy , pathExists } from "fs-extra" ;
@@ -212,6 +212,7 @@ export async function ɵcodegenFunctionsDirectory(
212
212
213
213
let bootstrapScript : string ;
214
214
if ( browserLocales ) {
215
+ const serverOutputPosixPath = serverOutputPath . split ( sep ) . join ( posix . sep ) ;
215
216
const locales = serverLocales ?. filter ( ( it ) => browserLocales . includes ( it ) ) ;
216
217
bootstrapScript = `const localizedApps = new Map();
217
218
const ffi18n = import("firebase-frameworks/i18n");
@@ -227,8 +228,8 @@ exports.handle = function(req,res) {
227
228
} else {
228
229
${
229
230
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 } \`))`
232
233
} .then(server => {
233
234
const app = server.app(locale);
234
235
localizedApps.set(locale, app);
@@ -238,10 +239,11 @@ exports.handle = function(req,res) {
238
239
});
239
240
};\n` ;
240
241
} else if ( serverOutputPath ) {
242
+ const serverOutputPosixPath = serverOutputPath . split ( sep ) . join ( posix . sep ) ;
241
243
bootstrapScript = `const app = ${
242
244
serverEntry ?. endsWith ( ".mjs" )
243
- ? `import(\`./${ serverOutputPath } /${ serverEntry } \`)`
244
- : `Promise.resolve(require('./${ serverOutputPath } /${ serverEntry } '))`
245
+ ? `import(\`./${ serverOutputPosixPath } /${ serverEntry } \`)`
246
+ : `Promise.resolve(require('./${ serverOutputPosixPath } /${ serverEntry } '))`
245
247
} .then(server => server.app());
246
248
exports.handle = (req,res) => app.then(it => it(req,res));\n` ;
247
249
} else {
0 commit comments