From 2878436e35b51253298344e6352d7c1f1f316a47 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Tue, 21 May 2024 13:58:55 +0000 Subject: [PATCH] feat(nextjs): Ignore Prisma critical dependency warnings --- packages/nextjs/src/config/webpack.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index 5c06644f3b48..14cdad42a25e 100644 --- a/packages/nextjs/src/config/webpack.ts +++ b/packages/nextjs/src/config/webpack.ts @@ -660,10 +660,14 @@ function getRequestAsyncStorageModuleLocation( } function addOtelWarningIgnoreRule(newConfig: WebpackConfigObjectWithModuleRules): void { - const ignoreRule = { module: /@opentelemetry\/instrumentation/ }; + const ignoreRules = [ + { module: /@opentelemetry\/instrumentation/, message: /Critical dependency/ }, + { module: /@prisma\/instrumentation/, message: /Critical dependency/ }, + ]; + if (newConfig.ignoreWarnings === undefined) { - newConfig.ignoreWarnings = [ignoreRule]; + newConfig.ignoreWarnings = ignoreRules; } else if (Array.isArray(newConfig.ignoreWarnings)) { - newConfig.ignoreWarnings.push(ignoreRule); + newConfig.ignoreWarnings.push(...ignoreRules); } }