Always set the runBeforeMainModule bundle param on buildBundle()

Summary: This diff fixes https://github.com/facebook/metro-bundler/issues/78 by adding the `runBeforeMainModule` server parameter to the bundler. This is not the cleanest solution, but will be fixed once we use the Delta Bundler for builds from the CLI

Reviewed By: davidaurelio

Differential Revision: D6074469

fbshipit-source-id: 068926ef671d9f897ad9f1bd0540036a97340c00
This commit is contained in:
Rafael Oleza 2017-10-18 12:17:12 -07:00 committed by Facebook Github Bot
parent 58f3fa957e
commit 1a2a46a9fb
2 changed files with 5 additions and 2 deletions

View File

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

View File

@ -324,7 +324,10 @@ class Server {
}
async buildBundle(options: BundleOptions): Promise<Bundle> {
const bundle = await this._bundler.bundle(options);
const bundle = await this._bundler.bundle({
...options,
runBeforeMainModule: this._opts.runBeforeMainModule,
});
const modules = bundle.getModules();
const nonVirtual = modules.filter(m => !m.virtual);
bundleDeps.set(bundle, {