Skip to content

Commit 9f87ca4

Browse files
fix: content collections custom path (#67)
* fix: use process.env instead of import.meta.env to retrieve content dir * docs: add changeset
1 parent dd7fe3f commit 9f87ca4

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.changeset/thin-feet-return.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"apeu": patch
3+
---
4+
5+
Fixes an issue where CONTENT_PATH was no longer defined when using this project as a Git submodule.

src/lib/astro/loaders/glob-loader.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import {
77
type AvailableLanguage,
88
} from "../../../utils/i18n";
99

10-
const CONTENT_DIR: string = import.meta.env?.CONTENT_PATH ?? "./content";
10+
/* This is not a supported usage, so it could break. Currently `import.meta.
11+
* env` doesn't work anymore when using a path outside the project's root (ie.
12+
* when I'm using a Git submodules). Using `process.env` seems to fix that. */
13+
const CONTENT_DIR: string = process.env?.CONTENT_PATH ?? "./content";
1114

1215
const getLocalesPattern = () => {
1316
if (CONFIG.LANGUAGES.AVAILABLE.length > 1)

0 commit comments

Comments
 (0)