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 authored and facebook-github-bot committed Jul 13, 2018
1 parent b134789 commit 64a5b1d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
18 changes: 12 additions & 6 deletions packages/metro/src/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ class Server {
createModuleId: this._opts.createModuleId,
getRunModuleStatement: this._opts.getRunModuleStatement,
dev: options.dev,
runBeforeMainModule: options.runBeforeMainModule,
runBeforeMainModule: this._opts.getModulesRunBeforeMainModule(
path.relative(this._opts.projectRoot, entryPoint),
),
runModule: options.runModule,
sourceMapUrl: options.sourceMapUrl,
}),
Expand Down Expand Up @@ -285,7 +287,9 @@ class Server {
getRunModuleStatement: this._opts.getRunModuleStatement,
getTransformOptions: this._opts.getTransformOptions,
platform: options.platform,
runBeforeMainModule: options.runBeforeMainModule,
runBeforeMainModule: this._opts.getModulesRunBeforeMainModule(
path.relative(this._opts.projectRoot, entryPoint),
),
runModule: options.runModule,
sourceMapUrl: options.sourceMapUrl,
},
Expand Down Expand Up @@ -672,7 +676,9 @@ class Server {
createModuleId: this._opts.createModuleId,
dev: options.dev,
getRunModuleStatement: this._opts.getRunModuleStatement,
runBeforeMainModule: options.runBeforeMainModule,
runBeforeMainModule: this._opts.getModulesRunBeforeMainModule(
path.relative(this._opts.projectRoot, options.entryFile),
),
runModule: options.runModule,
sourceMapUrl: options.sourceMapUrl,
},
Expand Down Expand Up @@ -736,7 +742,9 @@ class Server {
createModuleId: this._opts.createModuleId,
getRunModuleStatement: this._opts.getRunModuleStatement,
dev: options.dev,
runBeforeMainModule: options.runBeforeMainModule,
runBeforeMainModule: this._opts.getModulesRunBeforeMainModule(
path.relative(this._opts.projectRoot, options.entryFile),
),
runModule: options.runModule,
sourceMapUrl: options.sourceMapUrl,
}),
Expand Down Expand Up @@ -1047,7 +1055,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 @@ -1109,7 +1116,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 64a5b1d

Please sign in to comment.