Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bumpy-experts-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes a bug in live collections that caused it to incorrectly complain about the collection being defined in the wrong file
4 changes: 2 additions & 2 deletions packages/astro/src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function getImporterFilename() {
!line.includes('defineCollection') &&
!line.includes('defineLiveCollection') &&
!line.includes('getImporterFilename') &&
line !== 'Error',
!line.startsWith('Error'),
);
if (!stackLine) {
return undefined;
Expand Down Expand Up @@ -113,7 +113,7 @@ export function defineLiveCollection<
S extends BaseSchema | undefined = undefined,
>(config: LiveCollectionConfig<L, S>): LiveCollectionConfig<L, S> {
const importerFilename = getImporterFilename();
if (!importerFilename?.includes('live.config')) {
if (importerFilename && !importerFilename.includes('live.config')) {
throw new AstroError({
...AstroErrorData.LiveContentConfigError,
message: AstroErrorData.LiveContentConfigError.message(
Expand Down