rebundle when routes and templates change

This commit is contained in:
Rich Harris
2017-12-20 17:34:23 -05:00
parent cd91bf2ca4
commit fefb0d96d7
9 changed files with 257 additions and 73 deletions

View File

@@ -1,7 +1,9 @@
const fs = require('fs');
const path = require('path');
const chalk = require('chalk');
const compilers = require('./compilers.js');
const generate_asset_cache = require('./generate_asset_cache.js');
const { dest } = require('../config.js');
function deferred() {
const d = {};
@@ -24,6 +26,12 @@ module.exports = function create_watcher() {
deferreds.client.promise,
deferreds.server.promise
]).then(([client_stats, server_stats]) => {
const client_info = client_stats.toJson();
fs.writeFileSync(path.join(dest, 'stats.client.json'), JSON.stringify(client_info, null, ' '));
const server_info = server_stats.toJson();
fs.writeFileSync(path.join(dest, 'stats.server.json'), JSON.stringify(server_info, null, ' '));
return generate_asset_cache(
client_stats.toJson(),
server_stats.toJson()