From 1722a4bbbe7902c912c2311338fbb1597fa171e9 Mon Sep 17 00:00:00 2001 From: Costin-Robert Sin Date: Wed, 3 Jul 2024 11:23:44 +0300 Subject: [PATCH 1/2] [windows] Add Windows compatibility for the `replacement` ESBuild plugin Previously, the separator for the filter regex was hardcoded to / (Unix separator). Now, we're also taking account for the \ (Windows separator) in the filter regex. Signed-off-by: Costin-Robert Sin --- packages/open-next/src/build.ts | 3 ++- packages/open-next/src/build/createServerBundle.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/open-next/src/build.ts b/packages/open-next/src/build.ts index 42f9497fd..bf61da359 100755 --- a/packages/open-next/src/build.ts +++ b/packages/open-next/src/build.ts @@ -333,7 +333,8 @@ async function createImageOptimizationBundle(config: OpenNextConfig) { plugins.push( openNextReplacementPlugin({ name: "opennext-14.1.1-image-optimization", - target: /plugins\/image-optimization\/image-optimization\.js/g, + target: + /plugins(\/|\\)image-optimization(\/|\\)image-optimization\.js/g, replacements: [ require.resolve( "./adapters/plugins/image-optimization/image-optimization.replacement.js", diff --git a/packages/open-next/src/build/createServerBundle.ts b/packages/open-next/src/build/createServerBundle.ts index af2235029..16772b962 100644 --- a/packages/open-next/src/build/createServerBundle.ts +++ b/packages/open-next/src/build/createServerBundle.ts @@ -207,7 +207,7 @@ async function generateBundle( const plugins = [ openNextReplacementPlugin({ name: `requestHandlerOverride ${name}`, - target: /core\/requestHandler.js/g, + target: /core(\/|\\)requestHandler\.js/g, deletes: disableNextPrebundledReact ? ["applyNextjsPrebundledReact"] : [], replacements: disableRouting ? [ @@ -219,7 +219,7 @@ async function generateBundle( }), openNextReplacementPlugin({ name: `utilOverride ${name}`, - target: /core\/util.js/g, + target: /core(\/|\\)util\.js/g, deletes: [ ...(disableNextPrebundledReact ? ["requireHooks"] : []), ...(disableRouting ? ["trustHostHeader"] : []), From 0115853a317a9b7af3f65f133e3d09adfd4b4fdf Mon Sep 17 00:00:00 2001 From: conico974 Date: Mon, 8 Jul 2024 19:57:13 +0200 Subject: [PATCH 2/2] Create shy-cups-notice.md --- .changeset/shy-cups-notice.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/shy-cups-notice.md diff --git a/.changeset/shy-cups-notice.md b/.changeset/shy-cups-notice.md new file mode 100644 index 000000000..f63ff5b91 --- /dev/null +++ b/.changeset/shy-cups-notice.md @@ -0,0 +1,5 @@ +--- +"open-next": patch +--- + +[windows] Add Windows compatibility for the `replacement` ESBuild plugin