diff --git a/packager/src/Bundler/index.js b/packager/src/Bundler/index.js index 9ca16e0f5..3bba3e840 100644 --- a/packager/src/Bundler/index.js +++ b/packager/src/Bundler/index.js @@ -57,7 +57,7 @@ export type GetTransformOptions = ( mainModuleName: string, options: {}, getDependencies: string => Promise>, -) => ExtraTransformOptions | Promise; +) => Promise; type Asset = { __packager_asset: boolean, @@ -762,13 +762,11 @@ class Bundler { const getDependencies = (entryFile: string) => this.getDependencies({...options, entryFile}) .then(r => r.dependencies.map(d => d.path)); - const extraOptions = this._getTransformOptions + + const extraOptions: Promise = this._getTransformOptions ? this._getTransformOptions(mainModuleName, options, getDependencies) - : null; - return Promise.resolve(extraOptions) - .then(extraOpts => { - return {...options, ...extraOpts}; - }); + : Promise.resolve(null); + return extraOptions.then(extraOpts => ({...options, ...extraOpts})); } getResolver(): Promise {