Skip to content

Image breaks on prerendering whenever there is another file with getStaticPaths and render(content) #16036

@alexanderniebuhr

Description

@alexanderniebuhr

Astro Info

Astro                    v6.0.8
Node                     v25.8.1
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  @astrojs/cloudflare
Integrations             none

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

No response

Describe the Bug

Whenever there is another file with await render(post) the image optimization for prerendered pages returns the following error

22:40:55 ├─ /index.html22:40:55 [ERROR] ReferenceError: Cannot access '$$Picture' before initialization
at file:///Users/alexanderniebuhr/Developer/tmp/astro-repro-css/dist/server/.prerender/chunks/Picture_BgQajNq-.mjs:745:12

What's the expected result?

Image optimization works in prerendering

Link to Minimal Reproducible Example

https://github.com/alexanderniebuhr/astro-v6-repro/tree/bug-2

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P4: importantViolate documented behavior or significantly impacts performance (priority)pkg: astroRelated to the core `astro` package (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions