@@ -23,13 +23,22 @@ module.exports.pitch = function (request) {
23
23
"// Hot Module Replacement" ,
24
24
"if(module.hot) {" ,
25
25
" // 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." ,
Has conversations. Original line has conversations.
39
+ " if(!locals) throw new Error('Aborting CSS HMR due to changed css-modules locals.');" ,
40
+ " update(newContent);" ,
41
+ " });" ,
33
42
" // When the module is disposed, remove the <style> tags" ,
34
43
" module.hot.dispose(function() { update(); });" ,
35
44
"}"