Vite doesn't seem to honor .gitignore and tries to parse unrelated html files
See original GitHub issueIs your feature request related to a problem? Please describe.
I have some .html
files lying around in my project, which should be ignored by Vite. But when I try to run vite, I get the following error:
$ vite
error when starting dev server:
Error: The following dependencies are imported but could not be resolved:
testlib123.es.js (imported by /home/fabd/Code/github/some-project/src/assets/__fab/__test.html)
Typically I like to exclude files with double underscore in my gitignore, but in this case I also have a .gitignore
IN this folder where __test.html is :
# private files
*
.gitignore
So for all intents and purposes it seems vite does not ignore unrelated html files, even when they are not called index.html
.
I also tried to place my test file outside of the src/
folder. For example from the project’s root folder ./__foo/__test.html
, same error.
Describe the solution you’d like Vite should probably honor the .gitignore, so that I can keep unrelated html files in my project’s folder.
Describe alternatives you’ve considered …
Additional context …
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
@fabd @yaquawa this is already being tracked here https://github.com/vitejs/vite/issues/2599
It seems the code does look for any html files, not just index.html
https://github.com/vitejs/vite/blob/bc35fe994d48b2bd7076474f4a1a7b8ae5e8f401/packages/vite/src/node/optimizer/scan.ts#L60
I could use optimizeDeps.entries I suppose.
In order to make it easy for beginners, would it make sense to ignore any html files besides the first one found, in the default scenario when user does not explicitly set any entries options?