withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
46.11k stars 2.44k forks source link

Cannot read properties of undefined (reading 'referencedImages') #9044

Closed J-env closed 11 months ago

J-env commented 11 months ago

Astro Info

Astro                    v3.5.0
Node                     v18.18.0
System                   Linux (x64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             @astrojs/preact

If this issue only occurs in one browser, which browser is a problem?

Chrome

Describe the Bug

In Astro3.5.0 version, when using the client:only directive, the image information in the browser will report an error.

image

Is this supposed to be the code generated in ssr mode? Client js code shouldn't be so complicated.

image

What's the expected result?

It would be better if the client code is the same as Astro3.4.4 version.

const s  = { src: '/static-dev/test.a2872d8e.avif',
    width: 626,
    height: 358,
    format: 'avif' }

export {s as t}

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-sdeict-ffgcqm?file=src%2Fcomponents%2FTest2.tsx,src%2Fcomponents%2FTest.astro

Participation

amxmln commented 11 months ago

I can confirm this issue also crops up when generating static pages that contain a framework component which includes an import.meta.glob statement that imports images (SVGs in my case).