diff --git a/.changeset/funny-mice-help.md b/.changeset/funny-mice-help.md new file mode 100644 index 0000000000..9cedc017cb --- /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 d08f151092..62f2fffbd6 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({