Skip to content

Commit

Permalink
fix: broken function entrypoints on windows (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
james-elicx authored Sep 1, 2023
1 parent f764fff commit c06b437
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/orange-swans-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cloudflare/next-on-pages': patch
---

Normalize the injected function entrypoints for Windows.
11 changes: 5 additions & 6 deletions packages/next-on-pages/src/buildApplication/buildWorkerFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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__/',
)}'
}`;
}

Expand Down

0 comments on commit c06b437

Please sign in to comment.