Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Astro 5 #262

Merged
merged 12 commits into from
Dec 30, 2024
Merged

Astro 5 #262

merged 12 commits into from
Dec 30, 2024

Conversation

Southpaw1496
Copy link
Contributor

@Southpaw1496 Southpaw1496 commented Dec 29, 2024

Update Astro from Astro 4 to Astro 5.

Changes:

  • Functions using the getCompiledContent() function of Markdown files are now asynchronous.
  • Uses of Astro.glob() are replaced with Vite's import.meta.glob() as Astro.glob() is deprecated. Calls are also now properly typed.

There are no user-facing changes, but the upgrade should pave the way for moving to more modern Astro features, such as Content Loaders. I have noticed some encoding issues when using the dev server, but these don't appear in the production site, so I think it's fine.


See preview on Cloudflare Pages: https://preview-262.quiltmc-org.pages.dev


const allPosts = (await Astro.glob("/src/pages/**/blog/*.md")).filter((p) =>
const allPosts = (Object.values(import.meta.glob("/src/pages/**/blog/*.md", {eager: true})) as [MarkdownInstance<BlogFrontMatter>]).filter((p) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is eager: true relevant for markdown files ?

Copy link
Contributor Author

@Southpaw1496 Southpaw1496 Dec 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. All of the examples in the docs (like this one and this one) use Markdown files and {eager: true}. I think it just loads the imported data immediately rather than having to do it later.

@Southpaw1496 Southpaw1496 merged commit 00d94f1 into main Dec 30, 2024
5 checks passed
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.

3 participants