Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de53c4d

Browse files
authored
fix edge middleware path on windows (#839)
1 parent 5f93039 commit de53c4d

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

.changeset/six-icons-knock.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/aws": patch
3+
---
4+
5+
fix edge middleware path on windows

packages/open-next/src/plugins/edge.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
loadRoutesManifest,
2020
} from "../adapters/config/util.js";
2121
import logger from "../logger.js";
22+
import { normalizePath } from "../utils/normalize-path.js";
2223
import { getCrossPlatformPathRegex } from "../utils/regex.js";
2324

2425
export interface IPluginSettings {
@@ -39,7 +40,9 @@ export function openNextEdgePlugins({
3940
isInCloudflare,
4041
}: IPluginSettings): Plugin {
4142
const entryFiles =
42-
middlewareInfo?.files.map((file: string) => path.join(nextDir, file)) ?? [];
43+
middlewareInfo?.files.map((file: string) =>
44+
normalizePath(path.join(nextDir, file)),
45+
) ?? [];
4346
const routes = middlewareInfo
4447
? [
4548
{
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function normalizePath(path: string) {
2+
return path.replace(/\\/g, "/");
3+
}

0 commit comments

Comments
 (0)