@@ -75,25 +75,25 @@ module.exports = class HtmlPwaPlugin {
7575 rel : 'icon' ,
7676 type : 'image/png' ,
7777 sizes : '32x32' ,
78- href : ` ${ publicPath } ${ iconPaths . favicon32 } ${ assetsVersionStr } `
78+ href : getTagHref ( publicPath , iconPaths . favicon32 , assetsVersionStr )
7979 } ) ,
8080 makeTag ( 'link' , {
8181 rel : 'icon' ,
8282 type : 'image/png' ,
8383 sizes : '16x16' ,
84- href : ` ${ publicPath } ${ iconPaths . favicon16 } ${ assetsVersionStr } `
84+ href : getTagHref ( publicPath , iconPaths . favicon16 , assetsVersionStr )
8585 } ) ,
8686
8787 // Add to home screen for Android and modern mobile browsers
8888 makeTag ( 'link' , manifestCrossorigin
8989 ? {
9090 rel : 'manifest' ,
91- href : ` ${ publicPath } ${ manifestPath } ${ assetsVersionStr } ` ,
91+ href : getTagHref ( publicPath , manifestPath , assetsVersionStr ) ,
9292 crossorigin : manifestCrossorigin
9393 }
9494 : {
9595 rel : 'manifest' ,
96- href : ` ${ publicPath } ${ manifestPath } ${ assetsVersionStr } `
96+ href : getTagHref ( publicPath , manifestPath , assetsVersionStr )
9797 }
9898 ) ,
9999 makeTag ( 'meta' , {
@@ -116,18 +116,18 @@ module.exports = class HtmlPwaPlugin {
116116 } ) ,
117117 makeTag ( 'link' , {
118118 rel : 'apple-touch-icon' ,
119- href : ` ${ publicPath } ${ iconPaths . appleTouchIcon } ${ assetsVersionStr } `
119+ href : getTagHref ( publicPath , iconPaths . appleTouchIcon , assetsVersionStr )
120120 } ) ,
121121 makeTag ( 'link' , {
122122 rel : 'mask-icon' ,
123- href : ` ${ publicPath } ${ iconPaths . maskIcon } ${ assetsVersionStr } ` ,
123+ href : getTagHref ( publicPath , iconPaths . maskIcon , assetsVersionStr ) ,
124124 color : themeColor
125125 } ) ,
126126
127127 // Add to home screen for Windows
128128 makeTag ( 'meta' , {
129129 name : 'msapplication-TileImage' ,
130- content : ` ${ publicPath } ${ iconPaths . msTileImage } ${ assetsVersionStr } `
130+ content : getTagHref ( publicPath , iconPaths . msTileImage , assetsVersionStr )
131131 } ) ,
132132 makeTag ( 'meta' , {
133133 name : 'msapplication-TileColor' ,
@@ -170,3 +170,11 @@ function makeTag (tagName, attributes, closeTag = false) {
170170 attributes
171171 }
172172}
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