Skip to content

Commit b055d88

Browse files
committed
Fix inferRemoteSize virtual module import
1 parent 9031c80 commit b055d88

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

packages/astro/src/assets/vite-plugin-assets.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,10 @@ export default function assets({ fs, settings, sync, logger }: Options): vite.Pl
143143
if (id === resolvedVirtualModuleId) {
144144
return {
145145
code: `
146-
export { getConfiguredImageService, isLocalService } from "astro/assets";
147-
import { getImage as getImageInternal } from "astro/assets";
148-
export { default as Image } from "astro/components/${imageComponentPrefix}Image.astro";
146+
export { getConfiguredImageService, isLocalService } from "astro/assets";
147+
import { getImage as getImageInternal } from "astro/assets";
148+
import { inferRemoteSize as inferRemoteSizeInternal } from "astro/assets/utils/inferRemoteSize.js";
149+
export { default as Image } from "astro/components/${imageComponentPrefix}Image.astro";
149150
export { default as Picture } from "astro/components/${imageComponentPrefix}Picture.astro";
150151
151152
export { default as Font } from "astro/components/Font.astro";

packages/astro/test/fixtures/core-image-infersize/src/pages/index.astro

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
2-
// https://avatars.githubusercontent.com/u/622227?s=64 is a .jpeg
2+
// https://avatars.githubusercontent.com/u/622227?s=64&v=4 is a .jpeg
33
import { Image, Picture, getImage, inferRemoteSize } from 'astro:assets';
44
5-
const { width, height } = await inferRemoteSize('https://avatars.githubusercontent.com/u/622227?s=64');
5+
const { width, height } = await inferRemoteSize('https://avatars.githubusercontent.com/u/622227?s=64&v=4');
66
77
const remoteImg = await getImage({
8-
src: 'https://avatars.githubusercontent.com/u/622227?s=64',
8+
src: 'https://avatars.githubusercontent.com/u/622227?s=64&v=4',
99
inferSize: true,
1010
alt: '',
1111
});
1212
---
13-
<Image src="https://avatars.githubusercontent.com/u/622227?s=64," inferSize={true} , alt="" />
14-
<Picture src="https://avatars.githubusercontent.com/u/622227?s=64," inferSize={true} , alt="" />
13+
<Image src="https://avatars.githubusercontent.com/u/622227?s=64&v=4" inferSize={true} alt="" />
14+
<Picture src="https://avatars.githubusercontent.com/u/622227?s=64&v=4" inferSize={true} alt="" />
1515
<img src={remoteImg.src} {...remoteImg.attributes} id="getImage" />
1616

1717
<div id="direct">

0 commit comments

Comments
 (0)