Skip to content

⚡ Bolt: Pre-optimize React UI images in Astro build step - #166

Open
fysp11 wants to merge 1 commit into
mainfrom
bolt-astro-react-image-optimization-14002687062346491211
Open

⚡ Bolt: Pre-optimize React UI images in Astro build step#166
fysp11 wants to merge 1 commit into
mainfrom
bolt-astro-react-image-optimization-14002687062346491211

Conversation

@fysp11

@fysp11 fysp11 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

💡 What: The optimization pre-optimizes project images at the Astro server level (in index.astro) and passes standard optimized image URLs to the React component (ProjectsView.tsx), where they are rendered with standard <img> tags.
🎯 Why: The <Image> component from astro:assets is not properly supported or processed when placed directly inside React (.tsx) UI components. Attempting to do so results in hydration errors or unoptimized, full-resolution images being shipped to the client. Pre-optimizing using getImage() fixes this.
📊 Impact: Substantially decreases data transfer usage, improves loading speed, and improves overall performance by correctly applying WebP conversion and resizing (800x600 for grid and 80x80 for list view) during the build, guaranteeing optimized imagery is delivered to the client instead of original full-size image assets.
🔬 Measurement: Verify the optimization by building the site (pnpm run build), navigating to the /projects page, and confirming that the image URLs map to the optimized _astro/ output variants and possess correct responsive dimensions.


PR created automatically by Jules for task 14002687062346491211 started by @fysp11

- Fix unsupported Astro `<Image>` tag in React by using standard `<img>` tags.
- Pre-optimize images during Astro server build using `getImage()` and Vite's `import.meta.glob`.
- Pass optimized URLs to the React component via props.
- Add journal entry explaining the Astro image optimization constraints in React files.

Co-authored-by: fysp11 <13081700+fysp11@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@kinsta

kinsta Bot commented Aug 2, 2026

Copy link
Copy Markdown

Preview deployments for fysp11.github.io ⚡️

Status Branch preview Commit preview
✅ Ready Visit preview Visit preview

Commit: 8ad9c3e663de5def85d780712666adeee4155796

Deployment ID: 76a3490a-a899-420c-801d-3ea5f1101623

Static site name: fysp11githubio-cleb3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant