Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flat routes are broken on macOS (and probably Linux) in 1.12.0 #5324

Closed
1 task done
haines opened this issue Jan 31, 2023 · 4 comments
Closed
1 task done

Flat routes are broken on macOS (and probably Linux) in 1.12.0 #5324

haines opened this issue Jan 31, 2023 · 4 comments
Labels
bug:unverified duplicate This issue or pull request already exists

Comments

@haines
Copy link
Contributor

haines commented Jan 31, 2023

What version of Remix are you using?

1.12.0

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

Set future.v2_routeConvention = true, attempt to build app on macOS.

Expected Behavior

Routes are loaded, build succeeds

Actual Behavior

Build breaks when loading routes

ENOENT: no such file or directory, open '<root>/app/outes/<route file>'

Note it is trying to load from outes not routes!

The bug was introduced in #5266. By splitting and rejoining the paths, it drops the leading /, converting /Users/me/... to Users/me/.... However appDirectory still has a leading / so removing directory prefixes with slice drops one too many characters.

@machour
Copy link
Collaborator

machour commented Jan 31, 2023

Maybe related to #5322 (the outes thingy)

@haines
Copy link
Contributor Author

haines commented Jan 31, 2023

Workaround using patch-package:

patches/@remix-run+dev+1.12.0.patch:

diff --git a/node_modules/@remix-run/dev/dist/config/flat-routes.js b/node_modules/@remix-run/dev/dist/config/flat-routes.js
index e3646a7..52c0688 100644
--- a/node_modules/@remix-run/dev/dist/config/flat-routes.js
+++ b/node_modules/@remix-run/dev/dist/config/flat-routes.js
@@ -33,7 +33,7 @@ function flatRoutes(appDirectory, ignoredFilePatterns) {
   // fast-glob will return posix paths even on windows
   // convert posix to os specific paths
   let routePathsForOS = routePaths.map(routePath => {
-    return path__default["default"].join(...routePath.split(path__default["default"].posix.sep));
+    return path__default["default"].normalize(routePath);
   });
   return flatRoutesUniversal(appDirectory, routePathsForOS);
 }

@haines
Copy link
Contributor Author

haines commented Jan 31, 2023

Duplicate of #5322

@haines haines closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2023
itsMapleLeaf added a commit to itsMapleLeaf/charge-worlds that referenced this issue Feb 5, 2023
@MichaelDeBoey MichaelDeBoey added the duplicate This issue or pull request already exists label Feb 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2023

🤖 Hello there,

We just published version v0.0.0-nightly-a024557-20230207 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:unverified duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants