🐈

Astro 4.0から5.0への変更点

2024/12/09に公開

Astro 4.0から5.0への変更点のうち、
特に大きいものを取り上げます
https://docs.astro.build/en/guides/upgrade-to/v5/#breaking-changes

<ViewTransitions />が<ClientRouter />に名前変更

- import { ViewTransitions } from 'astro:transitions';
+ import { ClientRouter } from 'astro:transitions';

<html>
  <head>
    ...
-    <ViewTransitions />
+    <ClientRouter />
  </head>
</html>

https://docs.astro.build/en/guides/upgrade-to/v5/#renamed-viewtransitions--component

tsconfig.jsonの更新

{
  "extends": "astro/tsconfigs/base",
+  "include": [".astro/types.d.ts", "**/*"],
+  "exclude": ["dist"]
}

https://docs.astro.build/en/guides/upgrade-to/v5/#changed-typescript-configuration

非推奨:Astro.glob

---
- const posts = await Astro.glob('./posts/*.md');
+ const posts = Object.values(import.meta.glob('./posts/*.md', { eager: true }));
---

{posts.map((post) => <li><a href={post.url}>{post.frontmatter.title}</a></li>)}

https://docs.astro.build/en/guides/upgrade-to/v5/#deprecated-astroglob

Discussion