Skip to content

Commit ed0820f

Browse files
authored
feat: warn if image resizing enabled but sharp is not passed to config (#6763)
Warning will now show if image resizing enabled, but sharp is not passed to config. Fixes #6755
1 parent e148243 commit ed0820f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/payload/src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,16 @@ export class BasePayload<TGeneratedTypes extends GeneratedTypes> {
429429
this.email = consoleEmailAdapter({ payload: this })
430430
}
431431

432+
// Warn if image resizing is enabled but sharp is not installed
433+
if (
434+
!this.config.sharp &&
435+
this.config.collections.some((c) => c.upload.imageSizes || c.upload.formatOptions)
436+
) {
437+
this.logger.warn(
438+
`Image resizing is enabled for one or more collections, but sharp not installed. Please install 'sharp' and pass into the config.`,
439+
)
440+
}
441+
432442
this.sendEmail = this.email['sendEmail']
433443

434444
serverInitTelemetry(this)

0 commit comments

Comments
 (0)