-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Astro Info
Astro v5.12.0
Node v22.13.1
System Windows (x64)
Package Manager pnpm
Output server
Adapter @astrojs/node
Integrations none
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When an Astro project has both live.config.ts and content.config.ts files, astro sync will fail to sync the types with the following error:
Cannot read properties of undefined (reading 'object'), causing both content configs to never load.
Moving the build-time collections to live.config.ts causes Astro to not recognize the build-time collections and tries to handle them in the legacy way. Naturally, moving the runtime ones to content.config.ts results in a different error: (0 , __vite_ssr_import_0__.defineLiveCollection) is not a function, although this is expected.
What's the expected result?
Both files should be processed correctly, and Astro should be able to distinguish and support both collection types.
A possible use case for this is to have a live collection for constantly updating content (products, customer lists) and a regular build-time one for content that doesn't update as often (blog posts), or to have a collection loaded at build-time for development, and another at runtime for production; they needn't even need to be the same name (e.g. "posts", "livePosts"):
---
import { getLiveEntry, getEntry } from "astro:collections";
export const prerender = false;
const { slug } = Astro.params;
const post = import.meta.env.PROD
? (await getLiveEntry("livePosts", slug)).entry
: await getEntry("posts", slug);
if(!post) {
Astro.redirect("/404");
}
const { Content } = await post.render();
---
<Content />Link to Minimal Reproducible Example
Participation
- I am willing to submit a pull request for this issue.