Clean metro server correctly after bundle errors

Summary:
This is a very similar fix than D8858846, but done in the RN CLI (soon we'll be able to just call `Metro.runBuild()` from RN which will remove this duplication).

This actually fixes the issues in the integtration tests (t31612131). It's just funny that two unrelated problems that are caused by the same issue located in two different places have been reported at the same time.

Differential Revision: D8859276

fbshipit-source-id: 805e111a406f2a7c1b3df3ab02accf4c4041a464
This commit is contained in:
Rafael Oleza 2018-07-17 03:14:57 -07:00 коммит произвёл Facebook Github Bot
Родитель 51cf9eb3e8
Коммит 8ef90df28c
1 изменённых файлов: 14 добавлений и 14 удалений

Просмотреть файл

@ -107,23 +107,23 @@ async function buildBundle(
workerPath: config.getWorkerPath && config.getWorkerPath(),
});
const bundle = await output.build(server, requestOpts);
try {
const bundle = await output.build(server, requestOpts);
await output.save(bundle, args, log);
await output.save(bundle, args, log);
// Save the assets of the bundle
const outputAssets = await server.getAssets({
...Server.DEFAULT_BUNDLE_OPTIONS,
...requestOpts,
bundleType: 'todo',
});
// Save the assets of the bundle
const outputAssets = await server.getAssets({
...Server.DEFAULT_BUNDLE_OPTIONS,
...requestOpts,
bundleType: 'todo',
});
// When we're done saving bundle output and the assets, we're done.
const assets = await saveAssets(outputAssets, args.platform, args.assetsDest);
server.end();
return assets;
// When we're done saving bundle output and the assets, we're done.
return await saveAssets(outputAssets, args.platform, args.assetsDest);
} finally {
server.end();
}
}
module.exports = buildBundle;