File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
plugin/src/templates/edge Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 11import { Accepts } from "https://deno.land/x/accepts@2.1.1/mod.ts" ;
22import type { Context } from "netlify:edge" ;
3+ // Available at build time
34import imageconfig from "../functions-internal/_ipx/imageconfig.json" assert {
45 type : "json" ,
56} ;
67
78const defaultFormat = "webp"
89
10+ interface ImageConfig extends Record < string , unknown > {
11+ formats ?: string [ ] ;
12+ }
13+
914/**
1015 * Implement content negotiation for images
1116 */
@@ -14,7 +19,7 @@ const defaultFormat = "webp"
1419const handler = async ( req : Request , context : Context ) => {
1520 const { searchParams } = new URL ( req . url ) ;
1621 const accept = new Accepts ( req . headers ) ;
17- const { formats = [ defaultFormat ] } = imageconfig ;
22+ const { formats = [ defaultFormat ] } = imageconfig as ImageConfig ;
1823 if ( formats . length === 0 ) {
1924 formats . push ( defaultFormat ) ;
2025 }
You can’t perform that action at this time.
0 commit comments