fix: image loading on odd sizes now works

This commit is contained in:
Corbin Crutchley
2023-04-08 21:42:48 -07:00
parent f663da966d
commit 0c0bdf9f79
2 changed files with 5 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ import {
GetPictureParams,
GetPictureResult,
} from "@astrojs/image/dist/lib/get-picture";
import sharp_service from "../../../node_modules/@astrojs/image/dist/loaders/sharp.js";
import squoosh_service from "../../../node_modules/@astrojs/image/dist/loaders/squoosh.js";
export function getPicture(
params: GetPictureParams
@@ -11,8 +11,8 @@ export function getPicture(
// HACK: This is a hack that heavily relies on `getImage`'s internals :(
globalThis.astroImage = {
...(globalThis.astroImage || {}),
loader: globalThis.astroImage?.loader ?? sharp_service,
defaultLoader: globalThis.astroImage?.defaultLoader ?? sharp_service,
loader: globalThis.astroImage?.loader ?? squoosh_service,
defaultLoader: globalThis.astroImage?.defaultLoader ?? squoosh_service,
};
return astroImage.getPicture(params);