@@ -151,27 +151,29 @@ module.exports = class HtmlPwaPlugin {
151
151
} )
152
152
} )
153
153
154
- compiler . hooks . emit . tapAsync ( ID , ( data , cb ) => {
155
- const {
156
- name,
157
- themeColor,
158
- manifestPath,
159
- manifestOptions
160
- } = this . options
161
- const publicOptions = {
162
- name,
163
- short_name : name ,
164
- theme_color : themeColor
165
- }
166
- const outputManifest = JSON . stringify (
167
- Object . assign ( publicOptions , defaultManifest , manifestOptions )
168
- )
169
- data . assets [ manifestPath ] = {
170
- source : ( ) => outputManifest ,
171
- size : ( ) => outputManifest . length
172
- }
173
- cb ( null , data )
174
- } )
154
+ if ( ! isHrefAbsoluteUrl ( this . options . manifestPath ) ) {
155
+ compiler . hooks . emit . tapAsync ( ID , ( data , cb ) => {
156
+ const {
157
+ name,
158
+ themeColor,
159
+ manifestPath,
160
+ manifestOptions
161
+ } = this . options
162
+ const publicOptions = {
163
+ name,
164
+ short_name : name ,
165
+ theme_color : themeColor
166
+ }
167
+ const outputManifest = JSON . stringify (
168
+ Object . assign ( publicOptions , defaultManifest , manifestOptions )
169
+ )
170
+ data . assets [ manifestPath ] = {
171
+ source : ( ) => outputManifest ,
172
+ size : ( ) => outputManifest . length
173
+ }
174
+ cb ( null , data )
175
+ } )
176
+ }
175
177
}
176
178
}
177
179
@@ -185,8 +187,12 @@ function makeTag (tagName, attributes, closeTag = false) {
185
187
186
188
function getTagHref ( publicPath , href , assetsVersionStr ) {
187
189
let tagHref = `${ href } ${ assetsVersionStr } `
188
- if ( ! ( / ( h t t p ( s ? ) ) : \/ \/ / gi . test ( href ) ) ) {
190
+ if ( ! isHrefAbsoluteUrl ( href ) ) {
189
191
tagHref = `${ publicPath } ${ tagHref } `
190
192
}
191
193
return tagHref
192
194
}
195
+
196
+ function isHrefAbsoluteUrl ( href ) {
197
+ return / ( h t t p ( s ? ) ) : \/ \/ / gi. test ( href )
198
+ }
0 commit comments