-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vite must be restarted along with browser refresh to pick up new files using import.meta.glob #10616
Comments
out of curiosity, if you disable the cache in your browser does that also resolve it? If so, I ran into a similar cache issue recently - #10561 |
Heya! Do we have any idea where the fix could be in Vite? @brandonroberts can you go into your workaround? Edit: I've worked around this with the following plugin, which works with HMR. I run my own watcher.
|
I did something similar also https://github.com/analogjs/analog/blob/main/packages/platform/src/lib/router-plugin.ts#L30 |
Update on my end: I was able to delete all this code. Instead I used a virtual module that would have its glob be declared at build time, and then it all works as expected when modules are added and removed. |
@itsdouges do you have some sample code to share? I'd be interested in removing my workaround also |
Any updates on this? |
@itsdouges Could you share how you did that? I'm running into this issue as well. |
Nice! |
Describe the bug
I'm using the import.meta.glob here https://github.com/analogjs/analog/blob/main/packages/router to generate routes based on directory of files.
Adding new files is not invalidating the necessary modules, so refreshing the page does not produce a new set of files.
Reproduction
https://github.com/brandonroberts/analog-router-demo
Steps to reproduce
yarn dev
src/app/routes/about.ts
tosrc/app/routes/test.ts
and change thetemplate
The routes can also be updated by changing an existing file in the src/app/routes folder.
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: