Fix creation of indexed RAM bundles

Reviewed By: jeanlauliac

Differential Revision: D5852737

fbshipit-source-id: 98e16fbd69d9ad3666acfc86e5de308175102643
This commit is contained in:
David Aurelio 2017-09-18 11:05:18 -07:00 committed by Facebook Github Bot
parent f6e2e17900
commit 3f2b200e01
1 changed files with 2 additions and 3 deletions

View File

@ -13,7 +13,6 @@
'use strict';
const buildSourceMapWithMetaData = require('../../shared/output/unbundle/build-unbundle-sourcemap-with-metadata.js');
const nullthrows = require('fbjs/lib/nullthrows');
const {createRamBundleGroups} = require('../../Bundler/util');
const {
@ -64,8 +63,8 @@ function asIndexedRamBundle({
function* subtree(moduleTransport, moduleTransportsByPath, seen = new Set()) {
seen.add(moduleTransport.id);
for (const {path} of moduleTransport.dependencies) {
const dependency = nullthrows(moduleTransportsByPath.get(path));
if (!seen.has(dependency.id)) {
const dependency = moduleTransportsByPath.get(path);
if (dependency && !seen.has(dependency.id)) {
yield dependency.id;
yield* subtree(dependency, moduleTransportsByPath, seen);
}