From bb8db30a5e864c591496a29a96a657cb3ad046e0 Mon Sep 17 00:00:00 2001 From: Saman Date: Fri, 29 Mar 2024 23:06:31 +0330 Subject: [PATCH] fix: fix pwa icons being removed (#589) --- src/platforms/pwa/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/platforms/pwa/index.ts b/src/platforms/pwa/index.ts index 5c05fda..d00a502 100644 --- a/src/platforms/pwa/index.ts +++ b/src/platforms/pwa/index.ts @@ -143,7 +143,8 @@ export class PwaAssetGenerator extends AssetGenerator { const destDir = join(pwaAssetDir, PWA_ASSET_PATH); try { await mkdirp(destDir); - } catch { + } catch (e) { + console.log(e); // ignore error } @@ -364,7 +365,9 @@ export class PwaAssetGenerator extends AssetGenerator { // Delete icons that were replaced for (const icon of icons) { if (await pathExists(join(pwaDir, icon.src))) { - const exists = !!pwaAssets.find((i: any) => i.sizes === icon.sizes); + const exists = !!pwaAssets.find(({ template: { width, height } }) => { + return `${width}x${height}` === icon.sizes + }); if (!exists) { rmSync(join(pwaDir, icon.src)); warn(`DELETE ${icon.src}`);