Skip to content

Commit

Permalink
fix(vercel): sort valid widths before picking largest (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshjv committed Jan 13, 2022
1 parent e6779c5 commit f4a408f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/runtime/providers/vercel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { stringifyQuery } from 'ufo'
// https://vercel.com/docs/more/adding-your-framework#images

export const getImage: ProviderGetImage = (src, { modifiers, baseURL = '/_vercel/image' } = {}, ctx) => {
const validWidths = Object.values(ctx.options.screens || {}).sort()
const validWidths = Object.values(ctx.options.screens || {}).sort((a, b) => a - b)
const largestWidth = validWidths[validWidths.length - 1]
let width = Number(modifiers?.width || 0)

Expand Down

0 comments on commit f4a408f

Please sign in to comment.