From c06b4376eb0cad8b3a486f92af16b1ae0bab6eb0 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 1 Sep 2023 10:44:03 +0100 Subject: [PATCH] fix: broken function entrypoints on windows (#447) --- .changeset/orange-swans-peel.md | 5 +++++ .../src/buildApplication/buildWorkerFile.ts | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 .changeset/orange-swans-peel.md diff --git a/.changeset/orange-swans-peel.md b/.changeset/orange-swans-peel.md new file mode 100644 index 000000000..fac82ca5f --- /dev/null +++ b/.changeset/orange-swans-peel.md @@ -0,0 +1,5 @@ +--- +'@cloudflare/next-on-pages': patch +--- + +Normalize the injected function entrypoints for Windows. diff --git a/packages/next-on-pages/src/buildApplication/buildWorkerFile.ts b/packages/next-on-pages/src/buildApplication/buildWorkerFile.ts index 946be6540..8a62b7751 100644 --- a/packages/next-on-pages/src/buildApplication/buildWorkerFile.ts +++ b/packages/next-on-pages/src/buildApplication/buildWorkerFile.ts @@ -5,6 +5,7 @@ import { tmpdir } from 'os'; import { generateGlobalJs } from './generateGlobalJs'; import type { ProcessedVercelOutput } from './processVercelOutput'; import { getNodeEnv } from '../utils/getNodeEnv'; +import { normalizePath } from '../utils'; /** * Construct a record for the build output map. @@ -31,12 +32,10 @@ export function constructBuildOutputRecord( return `{ type: ${JSON.stringify(item.type)}, - entrypoint: '${item.entrypoint - .replace(outputDir, '') - .replace( - /^\/_worker\.js\/__next-on-pages-dist__\//, - './__next-on-pages-dist__/', - )}' + entrypoint: '${normalizePath(item.entrypoint.replace(outputDir, '')).replace( + /^\/_worker\.js\/__next-on-pages-dist__\//, + './__next-on-pages-dist__/', + )}' }`; }