[Feature?]: Option for <FileRoutes/> to Ignore some route files or directories
Duplicates
- [x] I have searched the existing issues
Latest version
- [x] I have tested the latest version
Summary 💡
My idea (and need) is to have the possibility to have some component files directly in my routes directory, that will NOT generate a new route
-- It'd be beneficial for having a better organized codebase.
Examples 🌈
Here is an example
Directory structure:
/src/routes/
|
+ ...
|
+ path1/
| |
| + index.jsx
| |
| + subpage.jsx
| |
| + _component1.jsx
+ ...
Here the _component1.jsx would be used by multiple pages in this directory (index and subpage) -- and it would not generate a new path in the router, so website.com/path1/_component1 would not exist.
Motivation 🔦
Some of my pages contain more code so I like to split some components into their individual files, but to make well structured, I'd like to store these component files where they are used.
Some other routers in other projects have this functionality but I couldn't find any info for SolidStart.
This would help to keep the code of one functionality in one place.
Thanks. Gabriel
As long as your component files use named exports and don't use export default, this should already work. FileRoutes only looks for files with a default export.
Any thoughts @Tyg-g about what @Brendonovich said?
Thanks for reminding me to return to this topic.
✔️ I can confirm that if there is no default export, the path doesn't show up in the sitemap.
❔ This is usable but not ideal, in my opinion.
-
It makes the use of the components less clean.
-
This effect of default vs. not default exports is obscure, and not self-explanatory - makes understanding the code more difficult. Can be a source of errors, or even a security risk, when a component is exposed inadvertently.
Maybe others have a different opinion on this. I'd still stick to my original proposal, I'd like to see an explicit distinction.
BTW for anyone interested...
It also seems like that components that are in a .directory (dot directory) WITH a default export also don't show up.
Are you satisified with this solution that we can close this issue?