@@ -23,13 +23,22 @@ module.exports.pitch = function (request) {
2323 "// Hot Module Replacement" ,
2424 "if(module.hot) {" ,
2525 " // When the styles change, update the <style> tags" ,
26- " if(!content.locals) {" ,
27- " module.hot.accept(" + loaderUtils . stringifyRequest ( this , "!!" + request ) + ", function() {" ,
28- " var newContent = require(" + loaderUtils . stringifyRequest ( this , "!!" + request ) + ");" ,
29- " if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];" ,
30- " update(newContent);" ,
31- " });" ,
32- " }" ,
26+ " module.hot.accept(" + loaderUtils . stringifyRequest ( this , "!!" + request ) + ", function() {" ,
27+ " var newContent = require(" + loaderUtils . stringifyRequest ( this , "!!" + request ) + ");" ,
28+ " if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];" ,
29+ " var locals = (function(a, b) {" ,
30+ " var key, idx = 0;" ,
31+ " for(key in a) {" ,
32+ " if(!b || a[key] !== b[key]) return false;" ,
33+ " idx++;" ,
34+ " }" ,
35+ " for(key in b) idx--;" ,
36+ " return idx === 0;" ,
37+ " }(content.locals, newContent.locals));" ,
38+ " // This error is caught and not shown and causes a full reload." ,
39+ " if(!locals) throw new Error('Aborting CSS HMR due to changed css-modules locals.');" ,
40+ " update(newContent);" ,
41+ " });" ,
3342 " // When the module is disposed, remove the <style> tags" ,
3443 " module.hot.dispose(function() { update(); });" ,
3544 "}"
0 commit comments