Skip to content

Commit

Permalink
fix(vite): consistently invalidate cache directory
Browse files Browse the repository at this point in the history
  • Loading branch information
lihbr committed Mar 19, 2023
1 parent bc3c92d commit c9d35f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/vite/AkteViteCache.ts
Expand Up @@ -31,7 +31,7 @@ export class AkteViteCache {

async setAppGlobalData(globalData: unknown): Promise<void> {
// Updating global data invalidates all cache
await rm(this._dir.data, { recursive: true });
await rm(this._dir.data, { recursive: true, force: true });

const globalDataRaw = JSON.stringify({ globalData });

Expand Down
6 changes: 3 additions & 3 deletions src/vite/plugins/buildPlugin.ts
Expand Up @@ -99,10 +99,10 @@ export const buildPlugin = <TGlobalData>(
if (env.mode === "development") {
debug("caching globalData, bulkData, and data...");

const cachingPromises: Promise<void>[] = [];

const globalData = await options.app.globalDataCache;
cachingPromises.push(cache.setAppGlobalData(globalData));
await cache.setAppGlobalData(globalData);

const cachingPromises: Promise<void>[] = [];

for (const file of options.app.files) {
cachingPromises.push(cache.setFileDataMap(file));
Expand Down

0 comments on commit c9d35f0

Please sign in to comment.