webpack/hot/log-apply-result.js

32 lines
1.0 KiB
JavaScript
Raw Normal View History

2015-03-12 06:48:00 +08:00
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
module.exports = function(updatedModules, renewedModules) {
var unacceptedModules = updatedModules.filter(function(moduleId) {
return renewedModules && renewedModules.indexOf(moduleId) < 0;
});
var log = require("./log");
2015-03-12 06:48:00 +08:00
if(unacceptedModules.length > 0) {
log("warning", "[HMR] The following modules couldn't be hot updated: (They would need a full reload!)");
2015-03-12 06:48:00 +08:00
unacceptedModules.forEach(function(moduleId) {
log("warning", "[HMR] - " + moduleId);
2015-03-12 06:48:00 +08:00
});
}
if(!renewedModules || renewedModules.length === 0) {
log("info", "[HMR] Nothing hot updated.");
2015-03-12 06:48:00 +08:00
} else {
log("info", "[HMR] Updated modules:");
2015-03-12 06:48:00 +08:00
renewedModules.forEach(function(moduleId) {
log("info", "[HMR] - " + moduleId);
2015-03-12 06:48:00 +08:00
});
var numberIds = renewedModules.every(function(moduleId) {
return typeof moduleId === "number";
});
if(numberIds)
log("info", "[HMR] Consider using the NamedModulesPlugin for module names.");
2015-03-12 06:48:00 +08:00
}
};