summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/funny-mice-help.md5
-rw-r--r--packages/astro/src/content/types-generator.ts4
2 files changed, 8 insertions, 1 deletions
diff --git a/.changeset/funny-mice-help.md b/.changeset/funny-mice-help.md
new file mode 100644
index 000000000..9cedc017c
--- /dev/null
+++ b/.changeset/funny-mice-help.md
@@ -0,0 +1,5 @@
+---
+"astro": patch
+---
+
+Fixes the content config type path on windows
diff --git a/packages/astro/src/content/types-generator.ts b/packages/astro/src/content/types-generator.ts
index d08f15109..62f2fffbd 100644
--- a/packages/astro/src/content/types-generator.ts
+++ b/packages/astro/src/content/types-generator.ts
@@ -345,8 +345,10 @@ function invalidateVirtualMod(viteServer: ViteDevServer) {
*/
function normalizeConfigPath(from: string, to: string) {
const configPath = path.relative(from, to).replace(/\.ts$/, '.js');
+ // on windows `path.relative` will use backslashes, these must be replaced with forward slashes
+ const normalizedPath = configPath.replaceAll('\\', '/');
- return `"${isRelativePath(configPath) ? '' : './'}${configPath}"` as const;
+ return `"${isRelativePath(configPath) ? '' : './'}${normalizedPath}"` as const;
}
async function writeContentFiles({