diff --git a/react-packager/src/BundlesLayout/__tests__/BundlesLayout-test.js b/react-packager/src/BundlesLayout/__tests__/BundlesLayout-test.js index 3a792a44..cca9c8a7 100644 --- a/react-packager/src/BundlesLayout/__tests__/BundlesLayout-test.js +++ b/react-packager/src/BundlesLayout/__tests__/BundlesLayout-test.js @@ -61,7 +61,7 @@ describe('BundlesLayout', () => { return newBundlesLayout().generateLayout(['/root/index.js']).then(bundles => expect(bundles).toEqual({ id: 'bundle.0', - modules: [dep('/root/index.js'), dep('/root/a.js')], + modules: ['/root/index.js', '/root/a.js'], children: [], }) ); @@ -88,10 +88,10 @@ describe('BundlesLayout', () => { return newBundlesLayout().generateLayout(['/root/index.js']).then(bundles => expect(bundles).toEqual({ id: 'bundle.0', - modules: [dep('/root/index.js')], + modules: ['/root/index.js'], children: [{ id:'bundle.0.1', - modules: [dep('/root/a.js')], + modules: ['/root/a.js'], children: [], }], }) @@ -124,13 +124,13 @@ describe('BundlesLayout', () => { return newBundlesLayout().generateLayout(['/root/index.js']).then(bundles => expect(bundles).toEqual({ id: 'bundle.0', - modules: [dep('/root/index.js')], + modules: ['/root/index.js'], children: [{ id: 'bundle.0.1', - modules: [dep('/root/a.js')], + modules: ['/root/a.js'], children: [{ id: 'bundle.0.1.2', - modules: [dep('/root/b.js')], + modules: ['/root/b.js'], children: [], }], }], @@ -164,10 +164,10 @@ describe('BundlesLayout', () => { return newBundlesLayout().generateLayout(['/root/index.js']).then(bundles => expect(bundles).toEqual({ id: 'bundle.0', - modules: [dep('/root/index.js')], + modules: ['/root/index.js'], children: [{ id: 'bundle.0.1', - modules: [dep('/root/a.js'), dep('/root/b.js')], + modules: ['/root/a.js', '/root/b.js'], children: [], }], }) @@ -200,10 +200,10 @@ describe('BundlesLayout', () => { return newBundlesLayout().generateLayout(['/root/index.js']).then( bundles => expect(bundles).toEqual({ id: 'bundle.0', - modules: [dep('/root/index.js'), dep('/root/a.js')], + modules: ['/root/index.js', '/root/a.js'], children: [{ id: 'bundle.0.1', - modules: [dep('/root/b.js')], + modules: ['/root/b.js'], children: [], }], }) diff --git a/react-packager/src/BundlesLayout/__tests__/BundlesLayoutIntegration-test.js b/react-packager/src/BundlesLayout/__tests__/BundlesLayoutIntegration-test.js index e1db98ab..f834ccf5 100644 --- a/react-packager/src/BundlesLayout/__tests__/BundlesLayoutIntegration-test.js +++ b/react-packager/src/BundlesLayout/__tests__/BundlesLayoutIntegration-test.js @@ -80,28 +80,17 @@ describe('BundlesLayout', () => { function stripPolyfills(bundle) { return Promise - .all([ - Promise.all( - bundle.modules.map(module => module - .getName() - .then(name => [module, name]) - ), - ), - Promise.all( - bundle.children.map(childModule => stripPolyfills(childModule)), - ), - ]) - .then(([modules, children]) => { - modules = modules - .filter(([module, name]) => { // filter polyfills + .all(bundle.children.map(childModule => stripPolyfills(childModule))) + .then(children => { + const modules = bundle.modules + .filter(moduleName => { // filter polyfills for (let p of polyfills) { - if (name.indexOf(p) !== -1) { + if (moduleName.indexOf(p) !== -1) { return false; } } return true; - }) - .map(([module, name]) => module.path); + }); return { id: bundle.id, diff --git a/react-packager/src/BundlesLayout/index.js b/react-packager/src/BundlesLayout/index.js index d7693a73..c6da3157 100644 --- a/react-packager/src/BundlesLayout/index.js +++ b/react-packager/src/BundlesLayout/index.js @@ -58,7 +58,7 @@ class BundlesLayout { return promiseWhile( () => pendingSyncDeps.length > 0, () => { - const dependencies = _.values(syncDependencies); + const dependencies = Object.keys(syncDependencies); if (dependencies.length > 0) { bundle.modules = dependencies; } @@ -72,7 +72,7 @@ class BundlesLayout { if (dep.path !== pendingSyncDep && !dep.isPolyfill()) { pendingSyncDeps.push(dep.path); } - syncDependencies[dep.path] = dep; + syncDependencies[dep.path] = true; this._moduleToBundle[dep.path] = bundle.id; }); deps.asyncDependencies.forEach(asyncDeps => {