0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00
astro/.changeset/long-months-rule.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
753 B
Markdown
Raw Normal View History

---
'astro': major
---
Deprecate Astro.glob
The `Astro.glob` function has been deprecated in favor of Content Collections and `import.meta.glob`.
- If you want to query for markdown and MDX in your project, use Content Collections.
- If you want to query source files in your project, use `import.meta.glob`(https://vitejs.dev/guide/features.html#glob-import).
Also consider using glob packages from npm, like [fast-glob](https://www.npmjs.com/package/fast-glob), especially if statically generating your site, as it is faster for most use-cases.
The easiest path is to migrate to `import.meta.glob` like so:
```diff
- const posts = Astro.glob('./posts/*.md');
+ const posts = Object.values(import.meta.glob('./posts/*.md', { eager: true }));
```