support HMR

This commit is contained in:
Rich Harris
2017-12-16 20:10:49 -05:00
parent 08ff7ad234
commit e4936375db
7 changed files with 546 additions and 338 deletions

View File

@@ -25,7 +25,7 @@ module.exports = function create_app(src, dest, routes, options) {
// need to fudge the mtime, because webpack is soft in the head
const stats = fs.statSync(main_built);
fs.utimesSync(main_built, stats.atimeMs - 9999, stats.mtimeMs - 9999);
fs.utimesSync(main_built, stats.atimeMs - 999999, stats.mtimeMs - 999999);
}
function create_server_routes() {
@@ -42,7 +42,7 @@ module.exports = function create_app(src, dest, routes, options) {
fs.writeFileSync(server_routes, `${imports}\n\n${exports}`);
const stats = fs.statSync(server_routes);
fs.utimesSync(server_routes, stats.atimeMs - 9999, stats.mtimeMs - 9999);
fs.utimesSync(server_routes, stats.atimeMs - 999999, stats.mtimeMs - 999999);
}
// TODO in dev mode, watch files