Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

only save the bits of client_info we need #251

Merged
merged 2 commits into from
May 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/cli/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)}`);
Expand Down
4 changes: 3 additions & 1 deletion src/cli/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down
2 changes: 1 addition & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down