ElMassimo / ElMassimo/vite_ruby

Allow `.` as a valid option for `sourceCodeDir`

Open
#425 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
1.6k
Forks
149
Avg merge
5h 13m
Merged PRs (30d)
2

Description

**Is your feature request related to a problem? Please describe.**

My team uses a mono-repo setup that uses Packwerk. We have various packs at paths such as `./packs/` and under those packs can be frontend assets at `./packs//app/frontend`. These packs reside next to a traditional top-level Rails app which hosts assets at `./app/frontend`. These all share a common configuration for Vite Ruby, and that means we would ideally set our `sourceCodeDir` to `.` so that all paths can be made relative to the root of the project. This seems to work just fine, but the default glob that is assigned to `sourceCodeDir` means that all files (`./**/*`) are scanned by Vite Ruby. This leads to long wait times for commands that trigger Vite Ruby to scan all files (e.g. the `bin/vite build` command).

**Describe the solution you'd like**

I'd like to be able to override the default file globs so that I can set the `sourceCodeDir` to `.`.

**Describe alternatives you've considered**

Currently, I set it up so that I have a default `sourceCodeDir` of `./app/frontend` with the others added to `additionalEntrypoints` and `watchAdditionalPaths`. The problem with this approach is that the Vite root ends up getting set to `./app/frontend` and I have to configure Vitest along with various plugins relative to that path even when the tests are not in the root project. It leads to confusing configurations if you are not aware of what Vite Ruby is doing behind the scenes.

**Additional context**

N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.