webpack: add HMR

This commit is contained in:
tkqubo
2015-11-01 11:47:26 +09:00
parent eb59a40d3c
commit 124f32ed3c
2 changed files with 162 additions and 0 deletions
+27
View File
@@ -13,3 +13,30 @@ let contextModule = context<SomeModule>('./someModule');
require(['./someModule', './otherModule'], (someModule: SomeModule, otherModule: any) => {
});
// check if HMR is enabled
if(module.hot) {
// accept update of dependency
module.hot.accept("./handler.js", function() {
//...
});
}
module.exports = null;
// check if HMR is enabled
if(module.hot) {
// accept itself
module.hot.accept();
// dispose handler
module.hot.dispose(function() {
// revoke the side effect
//...
});
}
var status: string = module.hot.status();