Skip to content

Commit db004fa

Browse files
authored
fix: check for existence of experimental images (#1392)
* fix: check for existence of experimental images * fix: add fallback array
1 parent 6fe2377 commit db004fa

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugin/src/index.ts

+17-16
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,17 @@ const plugin: NetlifyPlugin = {
7272

7373
checkNextSiteHasBuilt({ publish, failBuild })
7474

75-
const {
76-
appDir,
77-
basePath,
78-
i18n,
79-
images,
80-
target,
81-
ignore,
82-
trailingSlash,
83-
outdir,
84-
experimental: {
85-
images: { remotePatterns },
75+
let experimentalRemotePatterns = []
76+
const { appDir, basePath, i18n, images, target, ignore, trailingSlash, outdir, experimental } = await getNextConfig(
77+
{
78+
publish,
79+
failBuild,
8680
},
87-
} = await getNextConfig({
88-
publish,
89-
failBuild,
90-
})
81+
)
82+
83+
if (experimental.images) {
84+
experimentalRemotePatterns = experimental.images.remotePatterns || []
85+
}
9186

9287
if (isNextAuthInstalled()) {
9388
const config = await getRequiredServerFiles(publish)
@@ -128,7 +123,13 @@ const plugin: NetlifyPlugin = {
128123
nextConfig: { basePath, i18n },
129124
})
130125

131-
await setupImageFunction({ constants, imageconfig: images, netlifyConfig, basePath, remotePatterns })
126+
await setupImageFunction({
127+
constants,
128+
imageconfig: images,
129+
netlifyConfig,
130+
basePath,
131+
remotePatterns: experimentalRemotePatterns,
132+
})
132133

133134
await generateRedirects({
134135
netlifyConfig,

0 commit comments

Comments
 (0)