Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/ten-mangos-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@opennextjs/cloudflare": patch
---

fix: improve windows support
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ function evalManifest($PATH, $$$ARGS) {
},
fix: `
function evalManifest($PATH, $$$ARGS) {
const { platform } = require('process');
$PATH = platform === 'win32' ? $PATH.replaceAll('\\\\', '/') : $PATH;
${returnManifests}
throw new Error(\`Unexpected evalManifest(\${$PATH}) call!\`);
}`,
Expand Down
2 changes: 2 additions & 0 deletions packages/cloudflare/src/cli/build/patches/plugins/find-dir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ rule:
pattern: function findDir($DIR, $NAME) { $$$_ }
fix: |-
function findDir($DIR, $NAME) {
const { platform } = require('process');
$DIR = platform === 'win32' ? $DIR.replaceAll('\\\\', '/') : $DIR;
if ($DIR.endsWith(".next/server")) {
if ($NAME === "app") {
return ${appExists};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ function loadManifest($PATH, $$$ARGS) {
},
fix: `
function loadManifest($PATH, $$$ARGS) {
const { platform } = require('process');
$PATH = platform === 'win32' ? $PATH.replaceAll('\\\\', '/') : $PATH;
${returnManifests}
throw new Error(\`Unexpected loadManifest(\${$PATH}) call!\`);
}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { join } from "node:path";
import { type BuildOptions, getPackagePath } from "@opennextjs/aws/build/helper.js";
import { getCrossPlatformPathRegex } from "@opennextjs/aws/utils/regex.js";

import { normalizePath } from "../../utils/normalize-path.js";
import { patchCode, type RuleConfig } from "../ast/util.js";
import type { ContentUpdater } from "./content-updater.js";

Expand Down Expand Up @@ -41,7 +42,7 @@ async function getRule(buildOpts: BuildOptions) {
appPathsManifests = [];
}

const manifests = pagesManifests.concat(appPathsManifests);
const manifests = pagesManifests.concat(appPathsManifests).map((path) => normalizePath(path));

const htmlFiles = manifests.filter((file) => file.endsWith(".html"));
const jsFiles = manifests.filter((file) => file.endsWith(".js"));
Expand Down Expand Up @@ -83,7 +84,8 @@ function requirePage($PAGE, $DIST_DIR, $IS_APP_PATH) {
},
fix: `
function requirePage($PAGE, $DIST_DIR, $IS_APP_PATH) {
const pagePath = getPagePath($$$ARGS);
const { platform } = require('process');
const pagePath = platform === 'win32' ? getPagePath($$$ARGS).replaceAll('\\\\', '/') : getPagePath($$$ARGS);
${fnBody}
}`,
} satisfies RuleConfig;
Expand Down