Skip to content

Commit

Permalink
Use correct getModulesRunBeforeMainModule config param when building …
Browse files Browse the repository at this point in the history
…production bundles

Summary: This fixes #197

Differential Revision: D8818833

fbshipit-source-id: d80a824bb4fd90ef32104c651aa3c1ecc79ebad9
  • Loading branch information
rafeca committed Jul 13, 2018
1 parent 794601e commit 1a6f94c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
19 changes: 13 additions & 6 deletions packages/metro/src/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const parseCustomTransformOptions = require('./lib/parseCustomTransformOptions')
const parsePlatformFilePath = require('./node-haste/lib/parsePlatformFilePath');
const path = require('path');
const symbolicate = require('./Server/symbolicate/symbolicate');
const toLocalPath = require('./node-haste/lib/toLocalPath');
const transformHelpers = require('./lib/transformHelpers');
const url = require('url');

Expand Down Expand Up @@ -271,7 +272,9 @@ class Server {
createModuleId: this._opts.createModuleId,
getRunModuleStatement: this._opts.getRunModuleStatement,
dev: options.dev,
runBeforeMainModule: options.runBeforeMainModule,
runBeforeMainModule: this._opts.getModulesRunBeforeMainModule(
toLocalPath(this._opts.projectRoots, entryPoint),
),
runModule: options.runModule,
sourceMapUrl: options.sourceMapUrl,
}),
Expand Down Expand Up @@ -323,7 +326,9 @@ class Server {
getRunModuleStatement: this._opts.getRunModuleStatement,
getTransformOptions: this._opts.getTransformOptions,
platform: options.platform,
runBeforeMainModule: options.runBeforeMainModule,
runBeforeMainModule: this._opts.getModulesRunBeforeMainModule(
toLocalPath(this._opts.projectRoots, entryPoint),
),
runModule: options.runModule,
sourceMapUrl: options.sourceMapUrl,
},
Expand Down Expand Up @@ -713,7 +718,9 @@ class Server {
createModuleId: this._opts.createModuleId,
dev: options.dev,
getRunModuleStatement: this._opts.getRunModuleStatement,
runBeforeMainModule: options.runBeforeMainModule,
runBeforeMainModule: this._opts.getModulesRunBeforeMainModule(
toLocalPath(this._opts.projectRoots, options.entryFile),
),
runModule: options.runModule,
sourceMapUrl: options.sourceMapUrl,
},
Expand Down Expand Up @@ -777,7 +784,9 @@ class Server {
createModuleId: this._opts.createModuleId,
getRunModuleStatement: this._opts.getRunModuleStatement,
dev: options.dev,
runBeforeMainModule: options.runBeforeMainModule,
runBeforeMainModule: this._opts.getModulesRunBeforeMainModule(
toLocalPath(this._opts.projectRoots, options.entryFile),
),
runModule: options.runModule,
sourceMapUrl: options.sourceMapUrl,
}),
Expand Down Expand Up @@ -1091,7 +1100,6 @@ class Server {
minify,
excludeSource,
hot: true,
runBeforeMainModule: this._opts.getModulesRunBeforeMainModule(entryFile),
runModule: this._getBoolOptionFromQuery(urlObj.query, 'runModule', true),
inlineSourceMap: includeSource,
platform,
Expand Down Expand Up @@ -1145,7 +1153,6 @@ class Server {
entryModuleOnly: false,
excludeSource: false,
inlineSourceMap: false,
runBeforeMainModule: [],
runModule: true,
sourceMapUrl: null,
};
Expand Down
1 change: 0 additions & 1 deletion packages/metro/src/shared/types.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export type BundleOptions = {
minify: boolean,
onProgress: ?(doneCont: number, totalCount: number) => mixed,
+platform: ?string,
+runBeforeMainModule: Array<string>,
+runModule: boolean,
sourceMapUrl: ?string,
createModuleIdFactory?: () => (path: string) => number,
Expand Down

0 comments on commit 1a6f94c

Please sign in to comment.