nystudio107 / craft-plugin-vite

Plugin Vite is the conduit between Craft CMS plugins and Vite, with manifest.json & HMR support
MIT License
12 stars 11 forks source link

Configurable `DEVMODE_CACHE_DURATION` #3

Closed engram-design closed 3 years ago

engram-design commented 3 years ago

We've found the 30s cache of DEVMODE_CACHE_DURATION to be pretty slow (and annoying) for local dev via https://github.com/nystudio107/craft-plugin-vite/blob/2f3338d9f60c194e739533efc6bbc3f66e9fdf05/src/helpers/FileHelper.php#L38

This causes a delay when starting/stopping the dev server due to the cached result for fetching whether the dev server is running or not. Thinking this might be configurable in some fashion?

khalwat commented 3 years ago

It's probably only truly useful for repeated accesses during the same request, so setting it to 1s is probably a better default

khalwat commented 3 years ago

Addressed in: https://github.com/nystudio107/craft-plugin-vite/commit/44e442f857e16b78786ebf565bd2b7fca9815c41 & https://github.com/nystudio107/craft-vite/commit/e842bec2441e431da24d9602578b12be1bd778b5

engram-design commented 3 years ago

Nice one! And yeah, wasn't sure how you wanted to handle setting that sort of setting, in this module or the craft-vite plugin. Thanks!