Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit e69b96d

Browse files
committed
Support IE
No location.origin, so have to create it manually
1 parent c0bfa70 commit e69b96d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hotModuleReplacement.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
module.exports = function(compilationHash, publicPath, outputFilename) {
22
if (document) {
3+
var origin = document.location.protocol + '//' + document.location.hostname + (document.location.port ? ':' + document.location.port: '');
34
var styleSheets = document.getElementsByTagName('link');
45
for (var i = 0; i < styleSheets.length; i++) {
56
if (styleSheets[i].href) {
67
var hrefUrl = styleSheets[i].href.split('?');
78
var href = hrefUrl[0];
89
var hash = hrefUrl[1];
9-
if (hash !== compilationHash && href === document.location.origin + publicPath + outputFilename) {
10+
if (hash !== compilationHash && href === origin + publicPath + outputFilename) {
1011
var url = href + '?' + compilationHash;
1112
styleSheets[i].href = url;
1213
console.log('[HMR]', 'Reload css: ', url);

0 commit comments

Comments
 (0)