Skip to content

Commit 0398da0

Browse files
fix: posix and normalizedApp
1 parent 9112114 commit 0398da0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/react-router-fs-routes/flatRoutes.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ export function flatRoutesUniversal(
134134
let prefixLookup = new PrefixLookupTrie();
135135
let uniqueRoutes = new Map<string, RouteManifestEntry>();
136136
let routeIdConflicts = new Map<string, string[]>();
137+
let normalizedApp = normalizeSlashes(appDirectory);
138+
let appWithPrefix = path.posix.join(normalizedApp, prefix);
137139

138140
// id -> file
139141
let routeIds = new Map<string, string>();
@@ -142,9 +144,8 @@ export function flatRoutesUniversal(
142144
let normalizedFile = normalizeSlashes(file);
143145
let routeExt = path.extname(normalizedFile);
144146
let routeDir = path.dirname(normalizedFile);
145-
let normalizedApp = normalizeSlashes(appDirectory);
146147
let routeId =
147-
routeDir === path.posix.join(normalizedApp, prefix)
148+
routeDir === appWithPrefix
148149
? path.posix
149150
.relative(normalizedApp, normalizedFile)
150151
.slice(0, -routeExt.length)
@@ -174,7 +175,7 @@ export function flatRoutesUniversal(
174175
let pathname = createRoutePath(segments, raw, index);
175176

176177
routeManifest[routeId] = {
177-
file: path.relative(appDirectory, file),
178+
file: path.posix.relative(normalizedApp, file),
178179
id: routeId,
179180
path: pathname,
180181
};

0 commit comments

Comments
 (0)