From 75857cf11906b010ae34c0575e89f9108041556b Mon Sep 17 00:00:00 2001 From: conico974 Date: Sat, 20 Jul 2024 10:43:11 +0200 Subject: [PATCH] fix middleware for next 15 (#473) * fix middleware for next 15 latest canary * Create angry-fans-kick.md --- .changeset/angry-fans-kick.md | 5 +++++ packages/open-next/src/build/edge/createEdgeBundle.ts | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 .changeset/angry-fans-kick.md diff --git a/.changeset/angry-fans-kick.md b/.changeset/angry-fans-kick.md new file mode 100644 index 00000000..3f348909 --- /dev/null +++ b/.changeset/angry-fans-kick.md @@ -0,0 +1,5 @@ +--- +"open-next": patch +--- + +fix middleware for next 15 diff --git a/packages/open-next/src/build/edge/createEdgeBundle.ts b/packages/open-next/src/build/edge/createEdgeBundle.ts index d70d2cbf..fdde4dcc 100644 --- a/packages/open-next/src/build/edge/createEdgeBundle.ts +++ b/packages/open-next/src/build/edge/createEdgeBundle.ts @@ -89,6 +89,14 @@ export async function buildEdgeBundle({ const require = (await import("node:module")).createRequire(import.meta.url); const __filename = (await import("node:url")).fileURLToPath(import.meta.url); const __dirname = (await import("node:path")).dirname(__filename); + + const defaultDefineProperty = Object.defineProperty; + Object.defineProperty = function(o, p, a) { + if(p=== '__import_unsupported') { + return; + } + return defaultDefineProperty(o, p, a); + }; ` } ${additionalInject ?? ""}