Skip to content

Commit

Permalink
fix: fix pwa icons being removed (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
samanmohamadi authored Mar 29, 2024
1 parent e8c0454 commit bb8db30
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/platforms/pwa/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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}`);
Expand Down

0 comments on commit bb8db30

Please sign in to comment.