From 55aaba3cbcf3f83813acfcfb7911b14c4a043ba0 Mon Sep 17 00:00:00 2001 From: Kyle Gach Date: Thu, 8 Dec 2022 12:56:31 -0700 Subject: [PATCH 1/2] Update logic around `next/future/image` --- code/frameworks/nextjs/src/nextImport/webpack.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/frameworks/nextjs/src/nextImport/webpack.ts b/code/frameworks/nextjs/src/nextImport/webpack.ts index 1e8f40d22568..5ebaeec7bbfe 100644 --- a/code/frameworks/nextjs/src/nextImport/webpack.ts +++ b/code/frameworks/nextjs/src/nextImport/webpack.ts @@ -8,6 +8,7 @@ export function configureNextImport(baseConfig: WebpackConfig) { const isNext12 = semver.satisfies(nextJSVersion, '~12'); const isNext13 = semver.satisfies(nextJSVersion, '~13'); + const isNextVersionSmallerThan12dot2 = semver.lt(nextJSVersion, '12.2.0'); const isNextVersionSmallerThan13 = semver.lt(nextJSVersion, '13.0.0'); baseConfig.plugins = baseConfig.plugins ?? []; @@ -20,7 +21,7 @@ export function configureNextImport(baseConfig: WebpackConfig) { ); } - if (!isNext12) { + if (isNext12 && isNextVersionSmallerThan12dot2) { baseConfig.plugins.push( new IgnorePlugin({ resourceRegExp: /next\/future\/image$/, @@ -36,7 +37,7 @@ export function configureNextImport(baseConfig: WebpackConfig) { ); } - if (semver.lt(nextJSVersion, '12.2.0')) { + if (isNextVersionSmallerThan12dot2) { baseConfig.plugins.push( new IgnorePlugin({ resourceRegExp: /next\/dist\/shared\/lib\/app-router-context$/, From 675ab2b0c6523f2187cd96944bb9911f27e6de10 Mon Sep 17 00:00:00 2001 From: Kyle Gach Date: Thu, 8 Dec 2022 13:31:34 -0700 Subject: [PATCH 2/2] Update code/frameworks/nextjs/src/nextImport/webpack.ts Co-authored-by: Valentin Palkovic --- code/frameworks/nextjs/src/nextImport/webpack.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/frameworks/nextjs/src/nextImport/webpack.ts b/code/frameworks/nextjs/src/nextImport/webpack.ts index 5ebaeec7bbfe..b017462ae256 100644 --- a/code/frameworks/nextjs/src/nextImport/webpack.ts +++ b/code/frameworks/nextjs/src/nextImport/webpack.ts @@ -21,7 +21,7 @@ export function configureNextImport(baseConfig: WebpackConfig) { ); } - if (isNext12 && isNextVersionSmallerThan12dot2) { + if (!isNext12 || isNextVersionSmallerThan12dot2) { baseConfig.plugins.push( new IgnorePlugin({ resourceRegExp: /next\/future\/image$/,