Skip to content

Commit ddb0589

Browse files
authored
fix: Compiled config is now imported using pathToFileURL to avoid crashes on Windows (#968)
1 parent c399fa8 commit ddb0589

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/clean-lions-tan.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
fix: Compiled config is now imported using `pathToFileURL` to avoid crashes on Windows.

packages/cloudflare/src/cli/commands/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { existsSync } from "node:fs";
22
import { createRequire } from "node:module";
33
import path from "node:path";
4+
import url from "node:url";
45

56
import { compileOpenNextConfig } from "@opennextjs/aws/build/compileConfig.js";
67
import { normalizeOptions } from "@opennextjs/aws/build/helper.js";
@@ -71,7 +72,7 @@ export async function retrieveCompiledConfig() {
7172
process.exit(1);
7273
}
7374

74-
const config = await import(configPath).then((mod) => mod.default);
75+
const config = await import(url.pathToFileURL(configPath).href).then((mod) => mod.default);
7576
ensureCloudflareConfig(config);
7677

7778
return { config };

0 commit comments

Comments
 (0)