File tree 1 file changed +6
-1
lines changed
plugin/src/templates/edge
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { Accepts } from "https://deno.land/x/[email protected] /mod.ts" ;
2
2
import type { Context } from "netlify:edge" ;
3
+ // Available at build time
3
4
import imageconfig from "../functions-internal/_ipx/imageconfig.json" assert {
4
5
type : "json" ,
5
6
} ;
6
7
7
8
const defaultFormat = "webp"
8
9
10
+ interface ImageConfig extends Record < string , unknown > {
11
+ formats ?: string [ ] ;
12
+ }
13
+
9
14
/**
10
15
* Implement content negotiation for images
11
16
*/
@@ -14,7 +19,7 @@ const defaultFormat = "webp"
14
19
const handler = async ( req : Request , context : Context ) => {
15
20
const { searchParams } = new URL ( req . url ) ;
16
21
const accept = new Accepts ( req . headers ) ;
17
- const { formats = [ defaultFormat ] } = imageconfig ;
22
+ const { formats = [ defaultFormat ] } = imageconfig as ImageConfig ;
18
23
if ( formats . length === 0 ) {
19
24
formats . push ( defaultFormat ) ;
20
25
}
You can’t perform that action at this time.
0 commit comments