Skip to content

Commit 8450379

Browse files
authored
fix: settings requiring service to be set when settings domains or remotePatterns (#8266)
1 parent a78175c commit 8450379

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

.changeset/many-impalas-sit.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Fix `image.service` requiring to be set manually when `image.domains` or `image.remotePatterns` was assigned a value

packages/astro/src/core/config/schema.ts

+16-11
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ const ASTRO_CONFIG_DEFAULTS = {
2929
split: false,
3030
excludeMiddleware: false,
3131
},
32+
image: {
33+
service: { entrypoint: 'astro/assets/services/sharp', config: {} },
34+
},
3235
compressHTML: true,
3336
server: {
3437
host: false,
@@ -180,14 +183,18 @@ export const AstroConfigSchema = z.object({
180183
.default(ASTRO_CONFIG_DEFAULTS.redirects),
181184
image: z
182185
.object({
183-
service: z.object({
184-
entrypoint: z.union([
185-
z.literal('astro/assets/services/sharp'),
186-
z.literal('astro/assets/services/squoosh'),
187-
z.string(),
188-
]),
189-
config: z.record(z.any()).default({}),
190-
}),
186+
service: z
187+
.object({
188+
entrypoint: z
189+
.union([
190+
z.literal('astro/assets/services/sharp'),
191+
z.literal('astro/assets/services/squoosh'),
192+
z.string(),
193+
])
194+
.default(ASTRO_CONFIG_DEFAULTS.image.service.entrypoint),
195+
config: z.record(z.any()).default({}),
196+
})
197+
.default(ASTRO_CONFIG_DEFAULTS.image.service),
191198
domains: z.array(z.string()).default([]),
192199
remotePatterns: z
193200
.array(
@@ -213,9 +220,7 @@ export const AstroConfigSchema = z.object({
213220
)
214221
.default([]),
215222
})
216-
.default({
217-
service: { entrypoint: 'astro/assets/services/sharp', config: {} },
218-
}),
223+
.default(ASTRO_CONFIG_DEFAULTS.image),
219224
markdown: z
220225
.object({
221226
drafts: z.boolean().default(false),

0 commit comments

Comments
 (0)