You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(assets): resolve Picture TDZ error when combined with content render() (#16171)
* fix(assets): resolve Picture TDZ error when combined with content render (#16036)
Introduce an internal virtual module (virtual:astro-get-image) that exports
only getImage and imageConfig without any Astro component references. The
content runtime now imports from this narrower module instead of astro:assets,
breaking the circular initialization dependency that caused a TDZ
ReferenceError when prerendered pages using <Picture> were bundled in the
same chunk as content collection render() calls.
* chore: add changeset for Picture TDZ fix
* fix: rename virtual module to virtual:astro:get-image
Use colon separator (virtual:astro:*) instead of hyphen so the module
matches existing optimizeDeps.exclude patterns in both Astro core and
the Cloudflare adapter. The hyphenated name was not excluded from
Vite's dependency optimizer, causing esbuild to fail resolving it.
* fix: add virtual:astro:get-image to dev-only.d.ts and remove ts-expect-error
Add type declaration for the virtual:astro:get-image module so TypeScript
recognizes the import without needing a @ts-expect-error directive.
* Apply suggestion from @alexanderniebuhr
---------
Co-authored-by: uni <uni@vmi3197945.contaboserver.net>
Fixes a build error that occurred when a pre-rendered page used the `<Picture>` component and another page called `render()` on content collection entries.
0 commit comments