Does Vite's config caching cause stale asset references with dynamic imports?
0 reputation · 18 Jul 2022, 08:30 UTC
Vite utilizes an esbuild-based pre-bundling process and internal caching to optimize development startup times. When using glob patterns within the configuration to manage assets or dynamic imports, there is a potential for the cache to persist outdated references even after the underlying file structure changes.
In environments where dynamic imports are frequently modified or generated, it is unclear if Vite's internal watcher consistently invalidates these specific cached entries without a full manual cache clearance.
Verification Requirements
- Assume Vite version 5.x or later.
- Verify if
vite clear-cacheis the only reliable method to resolve 404 errors following dynamic import updates.
What is the specific trigger for cache invalidation when glob patterns are used in the config? Does Vite provide a programmatic way to refresh these references without restarting the entire dev server?