diff --git a/src/constant/constant.ts b/src/constant/constant.ts index 514910d..ce4c65c 100644 --- a/src/constant/constant.ts +++ b/src/constant/constant.ts @@ -12,7 +12,7 @@ const tempRoot = join( ); export const constant: IConstant = { - cacheVersion: 1, + cacheVersion: 2, endpoint: { index: "/api", polyfill: "/api/polyfill" diff --git a/src/service/registry/cache-registry/cache-registry-service.ts b/src/service/registry/cache-registry/cache-registry-service.ts index 6ee6fee..8f5ba86 100644 --- a/src/service/registry/cache-registry/cache-registry-service.ts +++ b/src/service/registry/cache-registry/cache-registry-service.ts @@ -194,7 +194,11 @@ export class CacheRegistryService implements ICacheRegistryService { const lastCachedConfigChecksum = await this.getLastCachedPolyfillConfigChecksum(); // If the config changed, the disk cache needs to be flushed - if (lastCachedConfigChecksum !== getPolyfillConfigChecksum()) return false; + if (lastCachedConfigChecksum !== getPolyfillConfigChecksum()) { + this.logger.debug(`The checksum for the config changed! Flushing cache...`); + await this.flushCache(); + return false; + } for (const [polyfillName, polyfill] of Object.entries(constant.polyfill)) { // Skip aliases