From 7db16a4020035a5528a7acc5209d67603ee0a6e6 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Thu, 30 Mar 2017 16:35:21 -0700 Subject: [PATCH] Remove RelayFBPreloadedModules, error on overlapping modules Reviewed By: davidaurelio Differential Revision: D4779671 fbshipit-source-id: f2dfeb696baab457769c22ca7ab28972270e5fc0 --- packager/src/Bundler/Bundle.js | 2 +- packager/src/Bundler/__tests__/Bundle-test.js | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/packager/src/Bundler/Bundle.js b/packager/src/Bundler/Bundle.js index b6bedf22a..2823e7ed2 100644 --- a/packager/src/Bundler/Bundle.js +++ b/packager/src/Bundler/Bundle.js @@ -420,7 +420,7 @@ function createGroups(ramGroups: Array, lazyModules) { // print a warning for each removed module const parentNames = parents.map(byId.get, byId); const lastName = parentNames.pop(); - console.warn( + throw new Error( /* $FlowFixMe: this assumes the element exists. */ `Module ${byId.get(moduleId)} belongs to groups ${ parentNames.join(', ')}, and ${lastName diff --git a/packager/src/Bundler/__tests__/Bundle-test.js b/packager/src/Bundler/__tests__/Bundle-test.js index a35770cd8..134abf6da 100644 --- a/packager/src/Bundler/__tests__/Bundle-test.js +++ b/packager/src/Bundler/__tests__/Bundle-test.js @@ -330,13 +330,10 @@ describe('Bundle', () => { it('omits modules that are contained by more than one group', () => { bundle = createBundle([fsLocation('React'), fsLocation('OtherFramework')]); - const {groups} = bundle.getUnbundle(); - expect(groups).toEqual(new Map([ - [idFor('React'), - new Set(['ReactFoo', 'ReactBar', 'cx'].map(idFor))], - [idFor('OtherFramework'), - new Set(['OtherFrameworkFoo', 'OtherFrameworkBar', 'crc32'].map(idFor))], - ])); + expect(() => { + const {groups} = bundle.getUnbundle(); //eslint-disable-line no-unused-vars + }).toThrow(new Error(`Module ${fsLocation('invariant')} belongs to groups ${fsLocation('React')}` + + `, and ${fsLocation('OtherFramework')}. Removing it from all groups.`)); }); it('ignores missing dependencies', () => {