Skip to content

Commit

Permalink
fix(meta): prevent build failure for ios splash image when no icon is…
Browse files Browse the repository at this point in the history
… used (#362)

* fix(meta): check ios launch scren for undefined before accessing proprieties

* feat(icon): display warning on console if the icon file was not found
  • Loading branch information
maybebot committed Oct 6, 2020
1 parent 304a356 commit 494eed5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/icon/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ async function run (pwa, _emitAssets) {

// Disable module if no icon specified
if (!options.source) {
// eslint-disable-next-line no-console
console.warn('[pwa] [icon] Icon not found in ' + path.resolve(this.options.srcDir, this.options.dir.static, options.fileName))
return
}

Expand Down
2 changes: 1 addition & 1 deletion lib/meta/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function generateMeta (pwa) {
}

// Launch Screen Image (IOS)
if (options.mobileAppIOS && !find(this.options.head.link, 'rel', 'apple-touch-startup-image')) {
if (options.mobileAppIOS && pwa._iosSplash && !find(this.options.head.link, 'rel', 'apple-touch-startup-image')) {
this.options.head.link.push({ href: pwa._iosSplash.iphonese, media: '(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)', rel: 'apple-touch-startup-image' })
this.options.head.link.push({ href: pwa._iosSplash.iphone6, media: '(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2)', rel: 'apple-touch-startup-image' })
this.options.head.link.push({ href: pwa._iosSplash.iphoneplus, media: '(device-width: 621px) and (device-height: 1104px) and (-webkit-device-pixel-ratio: 3)', rel: 'apple-touch-startup-image' })
Expand Down

0 comments on commit 494eed5

Please sign in to comment.