From 1fcf3f79ee9096b802ec8814e3755cefe3511f6c Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 3 May 2018 23:42:19 -0400 Subject: [PATCH 1/2] only save the bits of client_info we need --- src/cli/build.ts | 4 +++- src/middleware.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cli/build.ts b/src/cli/build.ts index c997f4a..1e45294 100644 --- a/src/cli/build.ts +++ b/src/cli/build.ts @@ -35,7 +35,9 @@ export async function build() { const client_stats = await compile(client); console.log(`${clorox.inverse(`\nbuilt client`)}`); console.log(client_stats.toString({ colors: true })); - fs.writeFileSync(path.join(output, 'client_info.json'), JSON.stringify(client_stats.toJson())); + fs.writeFileSync(path.join(output, 'client_info.json'), JSON.stringify({ + assets: client_stats.toJson().assetsByChunkName + })); const server_stats = await compile(server); console.log(`${clorox.inverse(`\nbuilt server`)}`); diff --git a/src/middleware.ts b/src/middleware.ts index 57c1d67..46bec23 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -90,7 +90,7 @@ export default function middleware({ routes, store }: { cache_control: 'max-age=31536000' }), - get_route_handler(client_info.assetsByChunkName, routes, store) + get_route_handler(client_info.assets, routes, store) ].filter(Boolean)); return middleware; From 4f98324a8a656b0c47e3b48750e10316e4bf314c Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 3 May 2018 23:46:41 -0400 Subject: [PATCH 2/2] oops, missed one --- src/cli/dev.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cli/dev.ts b/src/cli/dev.ts index 64357d3..76cc9d1 100644 --- a/src/cli/dev.ts +++ b/src/cli/dev.ts @@ -263,7 +263,9 @@ export async function dev(opts: { port: number, open: boolean }) { }, result: info => { - fs.writeFileSync(path.join(dir, 'client_info.json'), JSON.stringify(info, null, ' ')); + fs.writeFileSync(path.join(dir, 'client_info.json'), JSON.stringify({ + assets: info.assetsByChunkName + }, null, ' ')); deferreds.client.fulfil(); const client_files = info.assets.map((chunk: { name: string }) => `client/${chunk.name}`);