Feature Request: Ignore Specific Files in the app Directory
Bruno Amorim
Add support for a pattern or configuration to ignore specific files in the app directory, allowing developers to include auxiliary files, such as styles or utilities, without them being treated as routes.
Description
Currently, the app directory in expo-router automatically treats all files as routes. This makes it difficult to include non-route files like shared styles, constants, or utility functions within the same directory structure. For example, a _styles.tsx file would be treated as a route, which is not the intended behavior.
By adding a pattern or configuration to ignore files (e.g., files starting with an underscore _), developers can keep related files together while maintaining a clean route structure.
Proposed Solution
Introduce a convention where files prefixed with _ (e.g., _styles.tsx) are ignored when generating routes.
Alternatively, provide an option in the configuration file (e.g., expo-router.config.js) to specify files or patterns to ignore.
Example
With the proposed feature, the following structure:
arduino
Copiar código
app/
home/
index.tsx
_styles.tsx
about.tsx
_utils.ts
m
macinjoke
File-based routing without collocation is extremely painful.
I honestly think the lack of this feature is enough reason to consider other libraries.
m
macinjoke
m
macinjoke
I really want this feature too.