Skip to content

Commit d5a312b

Browse files
committed
Make the require patch optional
1 parent 5f197fc commit d5a312b

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

.changeset/whole-spiders-stay.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+
make the "require" patch optional

packages/cloudflare/src/cli/build/bundle-server.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ export async function bundleServer(buildOpts: BuildOptions): Promise<void> {
174174
*/
175175
export async function updateWorkerBundledCode(workerOutputFile: string): Promise<void> {
176176
const code = await readFile(workerOutputFile, "utf8");
177-
const patchedCode = await patchCodeWithValidations(code, [["require", patches.patchRequire]]);
177+
const patchedCode = await patchCodeWithValidations(code, [
178+
["require", patches.patchRequire, { isOptional: true }],
179+
]);
178180
await writeFile(workerOutputFile, patchedCode);
179181
}
180182

packages/cloudflare/src/cli/build/patches/plugins/open-next.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ export function patchResolveCache(updater: ContentUpdater, buildOpts: BuildOptio
1919
path.join(outputPath, packagePath, `index.mjs`)
2020
);
2121

22-
console.error({ index: indexPath });
23-
2422
return updater.updateContent("patch-resolve-cache", [
2523
{
2624
field: {

packages/cloudflare/src/cli/build/utils/apply-patches.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,5 @@ export async function patchCodeWithValidations(
2525
}
2626
}
2727

28-
console.log(`All ${patches.length} patches applied\n`);
2928
return patchedCode;
3029
}

0 commit comments

Comments
 (0)