@@ -75,25 +75,25 @@ module.exports = class HtmlPwaPlugin {
75
75
rel : 'icon' ,
76
76
type : 'image/png' ,
77
77
sizes : '32x32' ,
78
- href : ` ${ publicPath } ${ iconPaths . favicon32 } ${ assetsVersionStr } `
78
+ href : getTagHref ( publicPath , iconPaths . favicon32 , assetsVersionStr )
79
79
} ) ,
80
80
makeTag ( 'link' , {
81
81
rel : 'icon' ,
82
82
type : 'image/png' ,
83
83
sizes : '16x16' ,
84
- href : ` ${ publicPath } ${ iconPaths . favicon16 } ${ assetsVersionStr } `
84
+ href : getTagHref ( publicPath , iconPaths . favicon16 , assetsVersionStr )
85
85
} ) ,
86
86
87
87
// Add to home screen for Android and modern mobile browsers
88
88
makeTag ( 'link' , manifestCrossorigin
89
89
? {
90
90
rel : 'manifest' ,
91
- href : ` ${ publicPath } ${ manifestPath } ${ assetsVersionStr } ` ,
91
+ href : getTagHref ( publicPath , manifestPath , assetsVersionStr ) ,
92
92
crossorigin : manifestCrossorigin
93
93
}
94
94
: {
95
95
rel : 'manifest' ,
96
- href : ` ${ publicPath } ${ manifestPath } ${ assetsVersionStr } `
96
+ href : getTagHref ( publicPath , manifestPath , assetsVersionStr )
97
97
}
98
98
) ,
99
99
makeTag ( 'meta' , {
@@ -116,18 +116,18 @@ module.exports = class HtmlPwaPlugin {
116
116
} ) ,
117
117
makeTag ( 'link' , {
118
118
rel : 'apple-touch-icon' ,
119
- href : ` ${ publicPath } ${ iconPaths . appleTouchIcon } ${ assetsVersionStr } `
119
+ href : getTagHref ( publicPath , iconPaths . appleTouchIcon , assetsVersionStr )
120
120
} ) ,
121
121
makeTag ( 'link' , {
122
122
rel : 'mask-icon' ,
123
- href : ` ${ publicPath } ${ iconPaths . maskIcon } ${ assetsVersionStr } ` ,
123
+ href : getTagHref ( publicPath , iconPaths . maskIcon , assetsVersionStr ) ,
124
124
color : themeColor
125
125
} ) ,
126
126
127
127
// Add to home screen for Windows
128
128
makeTag ( 'meta' , {
129
129
name : 'msapplication-TileImage' ,
130
- content : ` ${ publicPath } ${ iconPaths . msTileImage } ${ assetsVersionStr } `
130
+ content : getTagHref ( publicPath , iconPaths . msTileImage , assetsVersionStr )
131
131
} ) ,
132
132
makeTag ( 'meta' , {
133
133
name : 'msapplication-TileColor' ,
@@ -170,3 +170,11 @@ function makeTag (tagName, attributes, closeTag = false) {
170
170
attributes
171
171
}
172
172
}
173
+
174
+ function getTagHref ( publicPath , href , assetsVersionStr ) {
175
+ let tagHref = `${ href } ${ assetsVersionStr } `
176
+ if ( ! ( / ( h t t p ( s ? ) ) : \/ \/ / gi. test ( href ) ) ) {
177
+ tagHref = `${ publicPath } ${ tagHref } `
178
+ }
179
+ return tagHref
180
+ }
0 commit comments