From 970f9335a9ec75cccbbe80b45696c271cc33113c Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Fri, 1 Jul 2016 06:56:11 -0700 Subject: [PATCH] allow `rn.cli-config.js` w/o `getTransformModulePath` Reviewed By: bestander Differential Revision: D3509026 fbshipit-source-id: d7db3de13ecc92f6ddfdcec3029c78915e1e66c0 --- local-cli/bundle/buildBundle.js | 7 ++++--- local-cli/dependencies/dependencies.js | 7 ++++--- local-cli/server/runServer.js | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/local-cli/bundle/buildBundle.js b/local-cli/bundle/buildBundle.js index cbcf1d866..d229d0ebf 100644 --- a/local-cli/bundle/buildBundle.js +++ b/local-cli/bundle/buildBundle.js @@ -32,9 +32,10 @@ function buildBundle(args, config, output = outputBundle, packagerInstance) { process.env.NODE_ENV = args.dev ? 'development' : 'production'; } - const transformModulePath = args.transformer ? - path.resolve(args.transformer) : - config.getTransformModulePath(); + const transformModulePath = + args.transformer ? path.resolve(args.transformer) : + typeof config.getTransformModulePath === 'function' ? config.getTransformModulePath() : + undefined; const options = { projectRoots: config.getProjectRoots(), diff --git a/local-cli/dependencies/dependencies.js b/local-cli/dependencies/dependencies.js index 00653b24a..14fd27def 100644 --- a/local-cli/dependencies/dependencies.js +++ b/local-cli/dependencies/dependencies.js @@ -54,9 +54,10 @@ function _dependencies(argv, config, resolve, reject, packagerInstance) { reject(`File ${rootModuleAbsolutePath} does not exist`); } - const transformModulePath = args.transformer ? - path.resolve(args.transformer) : - config.getTransformModulePath(); + const transformModulePath = + args.transformer ? path.resolve(args.transformer) : + typeof config.getTransformModulePath === 'function' ? config.getTransformModulePath() : + undefined; const packageOpts = { projectRoots: config.getProjectRoots(), diff --git a/local-cli/server/runServer.js b/local-cli/server/runServer.js index 09201c2f0..10e39b9df 100644 --- a/local-cli/server/runServer.js +++ b/local-cli/server/runServer.js @@ -69,9 +69,10 @@ function runServer(args, config, readyCallback) { } function getPackagerServer(args, config) { - const transformModulePath = args.transformer ? - path.resolve(args.transformer) : - config.getTransformModulePath(); + const transformModulePath = + args.transformer ? path.resolve(args.transformer) : + typeof config.getTransformModulePath === 'function' ? config.getTransformModulePath() : + undefined; return ReactPackager.createServer({ nonPersistent: args.nonPersistent,