diff --git a/.changeset/seven-rocks-sort.md b/.changeset/seven-rocks-sort.md new file mode 100644 index 000000000..32b4a25ac --- /dev/null +++ b/.changeset/seven-rocks-sort.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes how `injectRoute` parses route patterns on Windows diff --git a/packages/astro/src/core/routing/manifest/create.ts b/packages/astro/src/core/routing/manifest/create.ts index 053624961..ba40f3b1b 100644 --- a/packages/astro/src/core/routing/manifest/create.ts +++ b/packages/astro/src/core/routing/manifest/create.ts @@ -7,6 +7,7 @@ import path from 'path'; import slash from 'slash'; import { fileURLToPath } from 'url'; import { warn } from '../../logger/core.js'; +import { removeLeadingForwardSlash } from '../../path.js'; import { resolvePages } from '../../util.js'; import { getRouteGenerator } from './generator.js'; const require = createRequire(import.meta.url); @@ -294,7 +295,7 @@ export function createRouteManifest( const isDynamic = (str: string) => str?.[0] === '['; const normalize = (str: string) => str?.substring(1, str?.length - 1); - const segments = name + const segments = removeLeadingForwardSlash(name) .split(path.sep) .filter(Boolean) .map((s: string) => {