Skip to content

[Feature?]: Option for <FileRoutes/> to Ignore some route files or directories #1882

Closed

Description

@Tyg-g

Duplicates

  • I have searched the existing issues

Latest version

  • 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

Activity

  1. added
    enhancement
    on Apr 20, 2025
  2. Brendonovich commented on Apr 28, 2025

    @Brendonovich
    Collaborator

    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.

  3. brenelz commented on Jul 12, 2025

    @brenelz
    Contributor

    Any thoughts @Tyg-g about what @Brendonovich said?

  4. Tyg-g commented on Jul 21, 2025

    @Tyg-g
    Author

    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.

    1. It makes the use of the components less clean.

    2. 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.

  5. Tyg-g commented on Jul 21, 2025

    @Tyg-g
    Author

    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.

  6. brenelz commented on Aug 19, 2025

    @brenelz
    Contributor

    Are you satisified with this solution that we can close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfile routes

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions