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

@@ -6,7 +6,10 @@ const route_manager = require('../route_manager.js');
const { dest } = require('../config.js');
module.exports = function generate_asset_cache(clientInfo, serverInfo) {
const main_file = `/client/${clientInfo.assetsByChunkName.main}`;
let main_file = Array.isArray(clientInfo.assetsByChunkName.main) ?
`/client/${clientInfo.assetsByChunkName.main[0]}` : // omg webpack what the HELL are you doing
`/client/${clientInfo.assetsByChunkName.main}`;
const chunk_files = clientInfo.assets.map(chunk => `/client/${chunk.name}`);
const service_worker = generate_service_worker(chunk_files);