File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -2,16 +2,16 @@ module.exports = function(publicPath, outputFilename) {
22 if ( document ) {
33 var origin = document . location . protocol + '//' + document . location . hostname + ( document . location . port ? ':' + document . location . port : '' ) ;
44 var newHref = origin + publicPath + outputFilename
5- var styleSheets = document . getElementsByTagName ( 'link' ) ;
5+ var links = document . getElementsByTagName ( 'link' ) ;
66
77 //update the stylesheet corresponding to `outputFilename`
8- for ( var i = 0 ; i < styleSheets . length ; i ++ ) {
9- if ( styleSheets [ i ] . href ) {
10- var oldChunk = styleSheets [ i ] . href . split ( '.' ) [ 0 ] ;
11- var newChunk = newHref . split ( '.' ) [ 0 ] ;
8+ for ( var i = 0 ; i < links . length ; i ++ ) {
9+ if ( links [ i ] . href ) {
10+ var oldChunk = new URL ( links [ i ] . href ) ;
11+ var newChunk = new URL ( newHref ) ;
1212
13- if ( oldChunk === newChunk ) {
14- var oldSheet = styleSheets [ i ]
13+ if ( oldChunk . pathname === newChunk . pathname ) {
14+ var oldSheet = links [ i ]
1515 var url = newHref + '?' + ( + new Date )
1616 var head = document . getElementsByTagName ( 'head' ) [ 0 ]
1717 var link = document . createElement ( 'link' )
@@ -38,4 +38,3 @@ module.exports = function(publicPath, outputFilename) {
3838 }
3939 }
4040}
41-
You can’t perform that action at this time.
0 commit comments