remix: Invalid route module file: /....../app/routes/.DS_Store

Any time I open my app in the file system, Apple does this stupid thing and creates a .DS_Store file. Could we just ignore .DS_Store files in the routes?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 6
  • Comments: 22 (10 by maintainers)

Most upvoted comments

Yes. Every file in the routes directory is considered a route. So you need to move CSS files outside the routes

I tried to remove the .DS_Store files manually from the /routes directory, without success. This worked: find . -name ".DS_Store" -print -delete

https://remix.run/docs/en/v1/tutorials/jokes#styling says

You can put your CSS files anywhere you like within the app directory.

Except you cannot put it anywhere you like. You cannot put it in the /routes directory. smh.

rant I’m disappointed to see this “package by type” convention still happening more than 20 years after most developers decided it was a bad idea - it’s like saying all Blondes must live in the same apartment 🤦‍♂️

Ideally everyone that is closely connected would live in the same apartment (folder) - e.g. route, component, and css should all live together because they are closely connected. Complete strangers should live in different apartments - e.g unrelated routes, css, components, etc should be in different folders.

I’d much rather see any file named *.__route.js is considered a route no matter where it is in the /app folder. /rant

I’d like to ignore all “.” files once we add file name escaping. This will make editors live VIM happy when they use tmp files.

@pmlk I had to use **/*.test.* for it to work!

Maybe this is the wrong place, but since I tried to tackle my problem with ignoredRouteFiles I figure someone else might think the same thing and come across this issue/thread.

I’m testing my remix app with jest and I’m placing my test files alongside the route files, e.g.:

/routes/index.tsx
/routes/index.test.tsx

Unfortunately, this causes an error when I open any page: ReferenceError: describe is not defined.

Since the documentation for ignoredRouteFiles states the following

This is useful for ignoring dotfiles […] or CSS/test files you wish to colocate.

I figured setting ignoredRouteFiles: [".*", "*.test.tsx"], would solve my problem. But it seems that it does not.

What am I doing wrong or misunderstanding here? 😃

Except you cannot put it anywhere you like. You cannot put it in the /routes directory. smh.

Actually, this is not true, but it’s not your fault you didn’t know that. I just merged a docs PR to fix this: https://github.com/remix-run/remix/pull/1671

You can use ignoredRouteFiles in your Remix config to ignore any pattern you like (including *.css).

So yes, please do colocate your stuff. This issue is closed (the create-remix CLI generates config that ignore dotfiles by default).

Thanks!

Not quite. #989 will address @Ferdzzzzzzzz’s use case though.