Pass runBeforeMainModule option correctly when building prod bundles

Summary:
On D6248242, runBeforeMainModule was changed to `getModulesRunBeforeMainModule`, but the entry point used by opensource to build prod bundles was not updated. We couldn't catch this since we don't use this codepath internally

Fixes https://github.com/facebook/metro/issues/73

Reviewed By: mjesun

Differential Revision: D6556097

fbshipit-source-id: 889eaf825c7c3cdebe1ca4fc9831020a4a7d56dc
This commit is contained in:
Rafael Oleza 2017-12-13 08:17:36 -08:00 committed by Facebook Github Bot
parent 26159b6638
commit db47372f06
3 changed files with 6 additions and 1 deletions

View File

@ -439,7 +439,7 @@ describe('processRequest', () => {
onProgress: null,
platform: undefined,
resolutionResponse: null,
runBeforeMainModule: [],
runBeforeMainModule: ['InitializeCore'],
runModule: true,
sourceMapUrl: null,
unbundle: false,

View File

@ -213,6 +213,9 @@ class Server {
options = {
...options,
deltaBundleId: null,
runBeforeMainModule: this._opts.getModulesRunBeforeMainModule(
options.entryFile,
),
};
const fullBundle = await Serializers.fullBundle(

View File

@ -93,6 +93,7 @@ describe('basic_bundle', () => {
const bundleWithPolyfills = await Metro.build(
{
assetRegistryPath: ASSET_REGISTRY_PATH,
getModulesRunBeforeMainModule: () => ['InitializeCore'],
getPolyfills: () => [polyfill1, polyfill2],
projectRoots: [INPUT_PATH, POLYFILLS_PATH],
transformCache: Metro.TransformCaching.none(),
@ -112,6 +113,7 @@ describe('basic_bundle', () => {
const bundleWithoutPolyfills = await Metro.build(
{
assetRegistryPath: ASSET_REGISTRY_PATH,
getModulesRunBeforeMainModule: () => ['InitializeCore'],
getPolyfills: () => [],
projectRoots: [INPUT_PATH, POLYFILLS_PATH],
transformCache: Metro.TransformCaching.none(),