From c4cf5e73dde0b0290a282d51d525c84f845a9d1d Mon Sep 17 00:00:00 2001 From: Tony Sullivan Date: Wed, 29 Jun 2022 14:46:23 +0000 Subject: [PATCH] Fixes a bug in how `injectRoute` parses route patterns on Windows (#3763) * always remove a leading slash in the `injectRoute` pattern * chore: add changeset --- src/core/routing/manifest/create.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/routing/manifest/create.ts b/src/core/routing/manifest/create.ts index 053624961681..ba40f3b1b263 100644 --- a/src/core/routing/manifest/create.ts +++ b/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) => {