diff --git a/packages/start/src/router/routes.ts b/packages/start/src/router/routes.ts index f37596e25..be7cf9bfe 100644 --- a/packages/start/src/router/routes.ts +++ b/packages/start/src/router/routes.ts @@ -33,17 +33,17 @@ function defineRoutes(fileRoutes: Route[]) { }); if (!parentRoute) { - routes.push({ - ...route, - id, - path: id - // strip out escape group for escaping nested routes - e.g. foo(bar) -> foo - .replace(/\/\([^)/]+\)/g, "") - .replace(/\([^)/]+\)/g, "") - // replace . with / for flat routes - e.g. foo.bar -> foo/bar - // ensures that ... of splat routes is not replaced - .replace(/(? foo + .replace(/\/\([^)/]+\)/g, "") + .replace(/\([^)/]+\)/g, "") + // replace . with / for flat routes - e.g. foo.bar -> foo/bar + .replace(/\./g, "/") + // converts any splat route ... that got replaced back from /// + // this could be avoided with a lookbehind regex but safar has only supported them since mid 2023 + .replace("///", "..."); + + routes.push({ ...route, id, path }); return routes; } processRoute(