Breaking Changes
Astro 7’s breaking changes are manageable because they cluster into a few buckets.
Upgrade Risk Map
| Change | Risk | Who Cares |
|---|---|---|
| Vite 8 | Medium | custom Vite plugins, advanced build config, plugin authors |
| Rust compiler | Medium | projects with invalid .astro markup that used to pass |
| Sätteri default | Medium | projects using remark, rehype, or recma plugins |
compressHTML: 'jsx' | Medium | templates relying on newline whitespace between inline elements |
src/fetch.ts reserved | Low to medium | projects already using that filename |
| Experimental flags removed | Low | projects that opted into Astro 6 experimental features |
@astrojs/db removed | High if used | projects using Astro DB commands/package |
astro:transitions internals removed | Low | projects importing deprecated transition internals |
Removed Experimental Flags
Move stable configuration out of experimental, and delete flags that are now the default:
import { defineConfig, memoryCache } from 'astro/config';
export default defineConfig({
cache: {
provider: memoryCache(),
},
routeRules: {
'/blog/[...path]': { maxAge: 300, swr: 60 },
},
});
Delete old flags for:
experimental.loggerexperimental.queuedRenderingexperimental.rustCompilerexperimental.advancedRoutingexperimental.cacheexperimental.routeRules
Rust Compiler Strictness
The Rust compiler does less browser-like correction. That is good long-term, but it exposes real template bugs.
---
import Layout from '../layouts/Layout.astro';
---
<!-- Broken: Layout is never closed -->
<Layout>
<p>Content here</p>
Fix it by closing non-void elements and using valid nesting:
---
import Layout from '../layouts/Layout.astro';
---
<Layout>
<p>Content here</p>
</Layout>
Gotcha: If your page visually changes without a compile error, check invalid HTML nesting first. The old compiler could silently move elements around. Astro 7 leaves the browser to parse what you wrote.
Whitespace Default
compressHTML now defaults to 'jsx'. Newlines between inline elements no longer guarantee visible spaces.
<!-- May render as "helloworld" -->
<span>hello</span>
<em>world</em>
<!-- Explicit space -->
<span>hello</span> <em>world</em>
If the visual diff is too large to fix immediately, you can temporarily restore the old behavior:
import { defineConfig } from 'astro/config';
export default defineConfig({
compressHTML: true,
});
Use that as a migration crutch, not the default answer.
Removed APIs
Replace or remove these:
| Removed/deprecated | Replacement |
|---|---|
@astrojs/db | Node node:sqlite, Drizzle, or a database library for your host |
TRANSITION_AFTER_SWAP and related transition internals | literal lifecycle event names like astro:after-swap |
getContainerRenderer() from integration root | @astrojs/react/container-renderer and equivalent integration entrypoints |