Stencil dev server cacheDir stale cache invalidation strategy
0 reputation · 02 Jul 2021, 10:43 UTC
Stencil dev server cacheDir stale cache invalidation strategy
The development server stores compiled component artifacts in a directory specified by the cacheDir option, defaulting to a temporary location. When source files change, the server does not automatically purge or refresh the cached entries, causing stale component outputs to persist across rebuilds. This behavior can lead to confusing debugging sessions and inconsistent UI rendering during development.
Currently there is no documented configuration to control cache invalidation timing or strategy. The only workaround is to manually delete the cache directory or restart the dev server after code changes.
To better understand and potentially improve this workflow, we need to clarify the following:
- Is there a configuration flag or environment variable that triggers automatic cache invalidation on source change?
- Can a custom invalidation strategy be plugged into the dev server, for example via a plugin or lifecycle hook?
- What is the exact sequence of events that the dev server follows when running
stencil build --watchregarding cacheDir updates?