diff --git a/react-packager/src/Bundler/index.js b/react-packager/src/Bundler/index.js index b25ce4ca..b8bfb6ba 100644 --- a/react-packager/src/Bundler/index.js +++ b/react-packager/src/Bundler/index.js @@ -426,8 +426,33 @@ class Bundler { this._cache.invalidate(filePath); } - getShallowDependencies(entryFile) { - return this._resolver.getShallowDependencies(entryFile); + getShallowDependencies({ + entryFile, + platform, + dev = true, + minify = !dev, + hot = false, + generateSourceMaps = false, + }) { + return this.getTransformOptions( + entryFile, + { + dev, + platform, + hot, + generateSourceMaps, + projectRoots: this._projectRoots, + }, + ).then(transformSpecificOptions => { + const transformOptions = { + minify, + dev, + platform, + transform: transformSpecificOptions, + }; + + return this._resolver.getShallowDependencies(entryFile, transformOptions); + }); } stat(filePath) { diff --git a/react-packager/src/Resolver/index.js b/react-packager/src/Resolver/index.js index 8de8d5f8..fd67201f 100644 --- a/react-packager/src/Resolver/index.js +++ b/react-packager/src/Resolver/index.js @@ -120,8 +120,8 @@ class Resolver { }); } - getShallowDependencies(entryFile) { - return this._depGraph.getShallowDependencies(entryFile); + getShallowDependencies(entryFile, transformOptions) { + return this._depGraph.getShallowDependencies(entryFile, transformOptions); } stat(filePath) { diff --git a/react-packager/src/Server/index.js b/react-packager/src/Server/index.js index aa772685..f7b4b354 100644 --- a/react-packager/src/Server/index.js +++ b/react-packager/src/Server/index.js @@ -254,8 +254,15 @@ class Server { return this._bundler.hmrBundle(modules, host, port); } - getShallowDependencies(entryFile) { - return this._bundler.getShallowDependencies(entryFile); + getShallowDependencies(options) { + return Promise.resolve().then(() => { + if (!options.platform) { + options.platform = getPlatformExtension(options.entryFile); + } + + const opts = dependencyOpts(options); + return this._bundler.getShallowDependencies(opts); + }); } getModuleForPath(entryFile) {