Skip to content

Commit

Permalink
fix($hmr): always require hotModuleReplacement.js in DEV mode so HMR …
Browse files Browse the repository at this point in the history
…works when there is only 1 CSS module
  • Loading branch information
faceyspacey committed Jul 31, 2017
1 parent 870a848 commit c483e5a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ var LimitChunkCountPlugin = require("webpack/lib/optimize/LimitChunkCountPlugin"
var NS = fs.realpathSync(__dirname);

module.exports = function(source) {
return source;
if (process.env.NODE_ENV !== 'development') return source

// We need to always require hotModuleReplacement.js for HMR to work in a wierd scenario
// where only one css file is imported. Otherwise HMR breaks when modules are disposed.
return `${source}
require(${loaderUtils.stringifyRequest(this, path.join(__dirname, "hotModuleReplacement.js"))})`;
};

module.exports.pitch = function(request) {
Expand Down

0 comments on commit c483e5a

Please sign in to comment.