0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-27 22:19:04 -05:00

fix: content types reference to config on windows (#9877)

Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
This commit is contained in:
Fabian Kachlock 2024-01-31 16:28:23 +01:00 committed by GitHub
parent 38e40f1cc2
commit 7be5f94dcf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"astro": patch
---
Fixes the content config type path on windows

View file

@ -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({