-
-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b46128
commit 3a4cb53
Showing
1 changed file
with
16 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,13 +23,22 @@ module.exports.pitch = function (request) { | |
"// Hot Module Replacement", | ||
"if(module.hot) {", | ||
" // When the styles change, update the <style> tags", | ||
" if(!content.locals) {", | ||
" module.hot.accept(" + loaderUtils.stringifyRequest(this, "!!" + request) + ", function() {", | ||
" var newContent = require(" + loaderUtils.stringifyRequest(this, "!!" + request) + ");", | ||
" if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];", | ||
" update(newContent);", | ||
" });", | ||
" }", | ||
" module.hot.accept(" + loaderUtils.stringifyRequest(this, "!!" + request) + ", function() {", | ||
" var newContent = require(" + loaderUtils.stringifyRequest(this, "!!" + request) + ");", | ||
" if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];", | ||
" var locals = (function(a, b) {", | ||
" var key, idx = 0;", | ||
" for(key in a) {", | ||
" if(!b || a[key] !== b[key]) return false;", | ||
" idx++;", | ||
" }", | ||
" for(key in b) idx--;", | ||
" return idx === 0;", | ||
" }(content.locals, newContent.locals));", | ||
" // This error is caught and not shown and causes a full reload.", | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
alexander-akait
Member
|
||
" if(!locals) throw new Error('Aborting CSS HMR due to changed css-modules locals.');", | ||
" update(newContent);", | ||
" });", | ||
" // When the module is disposed, remove the <style> tags", | ||
" module.hot.dispose(function() { update(); });", | ||
"}" | ||
|
it should show warning or auto reload page but not abort error