From 5faac2ab806440d7672a87a031819722dc9e4d17 Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Tue, 16 May 2023 09:43:08 -0500 Subject: [PATCH] fix: ensure next-server patches only run on Netlify this keeps previous behavior for standalone next server --- packages/runtime/src/helpers/files.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/runtime/src/helpers/files.ts b/packages/runtime/src/helpers/files.ts index 28c6e3c84e..e6bf6ca943 100644 --- a/packages/runtime/src/helpers/files.ts +++ b/packages/runtime/src/helpers/files.ts @@ -393,19 +393,19 @@ const baseServerReplacements: Array<[string, string]> = [ const nextServerReplacements: Array<[string, string]> = [ [ `getMiddlewareManifest() {\n if (this.minimalMode) return null;`, - `getMiddlewareManifest() {\n if (this.minimalMode || (process.env.NEXT_DISABLE_NETLIFY_EDGE !== 'true' && process.env.NEXT_DISABLE_NETLIFY_EDGE !== '1')) return null;`, + `getMiddlewareManifest() {\n if (this.minimalMode || (process.env.NETLIFY && process.env.NEXT_DISABLE_NETLIFY_EDGE !== 'true' && process.env.NEXT_DISABLE_NETLIFY_EDGE !== '1')) return null;`, ], [ `generateCatchAllMiddlewareRoute(devReady) {\n if (this.minimalMode) return []`, - `generateCatchAllMiddlewareRoute(devReady) {\n if (this.minimalMode || (process.env.NEXT_DISABLE_NETLIFY_EDGE !== 'true' && process.env.NEXT_DISABLE_NETLIFY_EDGE !== '1')) return [];`, + `generateCatchAllMiddlewareRoute(devReady) {\n if (this.minimalMode || (process.env.NETLIFY && process.env.NEXT_DISABLE_NETLIFY_EDGE !== 'true' && process.env.NEXT_DISABLE_NETLIFY_EDGE !== '1')) return [];`, ], [ `generateCatchAllMiddlewareRoute() {\n if (this.minimalMode) return undefined;`, - `generateCatchAllMiddlewareRoute() {\n if (this.minimalMode || (process.env.NEXT_DISABLE_NETLIFY_EDGE !== 'true' && process.env.NEXT_DISABLE_NETLIFY_EDGE !== '1')) return undefined;`, + `generateCatchAllMiddlewareRoute() {\n if (this.minimalMode || (process.env.NETLIFY && process.env.NEXT_DISABLE_NETLIFY_EDGE !== 'true' && process.env.NEXT_DISABLE_NETLIFY_EDGE !== '1')) return undefined;`, ], [ `getMiddlewareManifest() {\n if (this.minimalMode) {`, - `getMiddlewareManifest() {\n if (!this.minimalMode && (process.env.NEXT_DISABLE_NETLIFY_EDGE === 'true' || process.env.NEXT_DISABLE_NETLIFY_EDGE === '1')) {`, + `getMiddlewareManifest() {\n if (!this.minimalMode && (process.env.NETLIFY && process.env.NEXT_DISABLE_NETLIFY_EDGE === 'true' || process.env.NEXT_DISABLE_NETLIFY_EDGE === '1')) {`, ], ]