diff --git a/package-lock.json b/package-lock.json index 5e61d85a44..c4e8dd544d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24209,7 +24209,7 @@ }, "plugin": { "name": "@netlify/plugin-nextjs", - "version": "4.8.0", + "version": "4.9.0", "license": "ISC", "dependencies": { "@netlify/functions": "^1.0.0", @@ -42588,4 +42588,4 @@ } } } -} +} \ No newline at end of file diff --git a/plugin/src/index.ts b/plugin/src/index.ts index 5fd0a1699b..a7ca1694a3 100644 --- a/plugin/src/index.ts +++ b/plugin/src/index.ts @@ -72,22 +72,17 @@ const plugin: NetlifyPlugin = { checkNextSiteHasBuilt({ publish, failBuild }) - const { - appDir, - basePath, - i18n, - images, - target, - ignore, - trailingSlash, - outdir, - experimental: { - images: { remotePatterns }, + let experimentalRemotePatterns = [] + const { appDir, basePath, i18n, images, target, ignore, trailingSlash, outdir, experimental } = await getNextConfig( + { + publish, + failBuild, }, - } = await getNextConfig({ - publish, - failBuild, - }) + ) + + if (experimental.images) { + experimentalRemotePatterns = experimental.images.remotePatterns || [] + } if (isNextAuthInstalled()) { const config = await getRequiredServerFiles(publish) @@ -128,7 +123,13 @@ const plugin: NetlifyPlugin = { nextConfig: { basePath, i18n }, }) - await setupImageFunction({ constants, imageconfig: images, netlifyConfig, basePath, remotePatterns }) + await setupImageFunction({ + constants, + imageconfig: images, + netlifyConfig, + basePath, + remotePatterns: experimentalRemotePatterns, + }) await generateRedirects({ netlifyConfig,