diff --git a/packages/@vue/cli-plugin-pwa/lib/HtmlPwaPlugin.js b/packages/@vue/cli-plugin-pwa/lib/HtmlPwaPlugin.js
index 25b4bfbe2a..f6683ef47e 100644
--- a/packages/@vue/cli-plugin-pwa/lib/HtmlPwaPlugin.js
+++ b/packages/@vue/cli-plugin-pwa/lib/HtmlPwaPlugin.js
@@ -111,13 +111,18 @@ module.exports = class HtmlPwaPlugin {
rel: 'manifest',
href: getTagHref(publicPath, manifestPath, assetsVersionStr)
}
- ),
- makeTag('meta', {
- name: 'theme-color',
- content: themeColor
- })
+ )
)
+ if (themeColor != null) {
+ data.head.push(
+ makeTag('meta', {
+ name: 'theme-color',
+ content: themeColor
+ })
+ )
+ }
+
// Add to home screen for Safari on iOS
data.head.push(
makeTag('meta', {
@@ -154,12 +159,14 @@ module.exports = class HtmlPwaPlugin {
content: getTagHref(publicPath, iconPaths.msTileImage, assetsVersionStr)
}))
}
- data.head.push(
- makeTag('meta', {
- name: 'msapplication-TileColor',
- content: msTileColor
- })
- )
+ if (msTileColor != null) {
+ data.head.push(
+ makeTag('meta', {
+ name: 'msapplication-TileColor',
+ content: msTileColor
+ })
+ )
+ }
cb(null, data)
})