Skip to content

Commit 7a1e773

Browse files
committed
fix(meta): fix issues regarding favicon.ico fallback
1 parent e4a052a commit 7a1e773

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

lib/meta/module.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,15 @@ function generateMeta (pwa) {
102102
}
103103

104104
// Icons
105-
if (options.favicon && options.icons && options.icons.length > 0) {
105+
if (options.icons && options.icons.length > 0) {
106106
const iconSmall = options.icons[0]
107107
const iconBig = options.icons[options.icons.length - 1]
108108

109109
// Shortcut icon
110-
head.link.push({ rel: 'shortcut icon', href: iconSmall.src })
111-
head.link.push({ rel: 'apple-touch-icon', href: iconBig.src, sizes: iconBig.sizes })
110+
if (options.favicon) {
111+
head.link.push({ rel: 'shortcut icon', href: iconSmall.src })
112+
head.link.push({ rel: 'apple-touch-icon', href: iconBig.src, sizes: iconBig.sizes })
113+
}
112114

113115
// Launch Screen Image (IOS)
114116
if (options.mobileAppIOS && pwa._iosSplash) {
@@ -134,14 +136,13 @@ function generateMeta (pwa) {
134136
})
135137
}
136138
}
137-
}
138-
139-
// Favicon.ico as fallback
140-
const favicon = join(nuxt.options.srcDir, nuxt.options.dir.static, 'favicon.ico')
141-
if (options.favicon && existsSync(favicon)) {
142-
// eslint-disable-next-line no-console
143-
console.warn('You are using a low quality icon, use icon png. See https://pwa.nuxtjs.org/icon')
144-
head.link.push({ rel: 'shortcut icon', href: nuxt.options.router.base + 'favicon.ico' })
139+
} else {
140+
// favicon.ico as fallback
141+
// TODO: Drop support as it is harmful: https://mathiasbynens.be/notes/rel-shortcut-icon
142+
const favicon = join(nuxt.options.srcDir, nuxt.options.dir.static, 'favicon.ico')
143+
if (existsSync(favicon)) {
144+
head.link.push({ rel: 'shortcut icon', href: nuxt.options.router.base + 'favicon.ico' })
145+
}
145146
}
146147

147148
// Title

0 commit comments

Comments
 (0)