Skip to content

Commit

Permalink
fix: use path.normalize to convert POSIX paths to OS-specific paths
Browse files Browse the repository at this point in the history
  • Loading branch information
haines committed Jan 31, 2023
1 parent ebfa645 commit 9c3a531
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/slimy-insects-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": patch
---

Fixed issue with `v2_routeConvention` on Unix-based systems
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
- gunners6518
- gyx1000
- hadizz
- haines
- hardingmatt
- helderburato
- HenryVogt
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-dev/__tests__/flat-routes-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ describe("flatRoutes", () => {

let files: [string, Omit<ConfigRoute, "file">][] = testFiles.map(
([file, route]) => {
let filepath = file.split("/").join(path.sep);
let filepath = path.normalize(file);
return [filepath, { ...route, file: filepath }];
}
);
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-dev/config/flat-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function flatRoutes(
// fast-glob will return posix paths even on windows
// convert posix to os specific paths
let routePathsForOS = routePaths.map((routePath) => {
return path.join(...routePath.split(path.posix.sep));
return path.normalize(routePath);
});

return flatRoutesUniversal(appDirectory, routePathsForOS);
Expand Down

0 comments on commit 9c3a531

Please sign in to comment.