Eptagone / Vite.AspNetCore

Small library to integrate Vite into ASP.NET projects
MIT License
264 stars 35 forks source link

Watch the manifest file for changes #88

Closed someguy20336 closed 10 months ago

someguy20336 commented 10 months ago

Fixes #87

In the PR, I am watching for changes in the manifest so ViteManifest is refreshed when the file is updated. This should ensure that upon deploying new client files, we aren't attempting to serve files from the old manifest. It also avoids needing to change the scope of the service (resulting in reading that file for every request).

I also considered using the Configuration Providers but ultimately didn't think that saved that much effort - but let me know that you think.

I was able to hack together a unit test, but let me know if you think of a better way to do it.

Resources:

someguy20336 commented 10 months ago

Should be all good on the warnings. chunks was still guaranteed to be set, but I don't think it is smart enough to follow the code into InitializeManifest, so I used the null! syntax there and made a comment. Let me know if you prefer something else.

Eptagone commented 10 months ago

Looks good for me. I'm merging now