Upgrading to Astro 6

I recently upgraded this site from Astro 4 to Astro 6 - two major versions in one go. Here’s what actually broke and how I fixed it.

What Changed

Astro 6 dropped support for several things that were deprecated in Astro 5:

The Migration

Replacing Astro.glob()

Before:

const allPosts = await Astro.glob('./**/*.md')

After:

const allPosts = Object.values(import.meta.glob('./**/*.md', { eager: true }))

The { eager: true } option makes the import synchronous, so the function no longer needs to be async. The returned module objects have the same frontmatter, url, and rawContent() shape as before.

Replacing <ViewTransitions />

Before:

import { ViewTransitions } from 'astro:transitions'
...
<ViewTransitions />

After:

import { ClientRouter } from 'astro:transitions'
...
<ClientRouter />

Fixing the RSS route

Astro 6 requires uppercase HTTP method names for API routes:

// Before
export const get = () => rss({ ... })

// After
export const GET = () => rss({ ... })

Was It Worth It?

Yes. The build is noticeably faster and the new defaults are sensible. The migration itself took less than an hour since the codebase was already avoiding most deprecated patterns.