Skip to content

Commit

Permalink
chore: use relative path from appDirectory for collision files
Browse files Browse the repository at this point in the history
Signed-off-by: Logan McAnsh <logan@mcan.sh>
  • Loading branch information
mcansh committed Mar 8, 2023
1 parent e78dbfb commit 00d1682
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion packages/remix-dev/__tests__/flat-routes-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,10 @@ describe("flatRoutes", () => {
// we had a collision as /route and /index are the same
expect(routes).toHaveLength(1);
expect(consoleError).toHaveBeenCalledWith(
getRouteIdConflictErrorMessage("routes/dashboard", testFiles)
getRouteIdConflictErrorMessage(
"routes/dashboard",
testFiles.map((file) => path.relative(APP_DIR, file))
)
);
});

Expand Down
6 changes: 4 additions & 2 deletions packages/remix-dev/config/flat-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ export function flatRoutesUniversal(

let conflict = routeIds.get(routeId);
if (conflict) {
let currentConflicts = routeIdConflicts.get(routeId) || [conflict];
currentConflicts.push(file);
let currentConflicts = routeIdConflicts.get(routeId) || [
path.relative(appDirectory, conflict),
];
currentConflicts.push(path.relative(appDirectory, file));
routeIdConflicts.set(routeId, currentConflicts);
continue;
}
Expand Down

0 comments on commit 00d1682

Please sign in to comment.