Permalink
Browse files

Allow rn-cli.config.js to specify the default transformer, again

Summary:
Restores feature introduced in #7961 after it's been paved partially by #7899

**Test Plan:** ran example in https://github.com/philikon/ReactNativify against a React Native with and without this patch
Closes #9799

Differential Revision: D3852601

Pulled By: mkonicek

fbshipit-source-id: fc3c80bdb254145fefa870eea1828b4ef33f9297
  • Loading branch information...
1 parent 4ab455b commit 111ed8d180d6a7dd693aa50fe9ae9fab322991c3 @philikon philikon committed with Facebook Github Bot 0 Sep 12, 2016
@@ -40,13 +40,18 @@ function buildBundle(args, config, output = outputBundle, packagerInstance) {
if (!packagerInstance) {
let assetExts = (config.getAssetExts && config.getAssetExts()) || [];
+ const transformModulePath =
+ args.transformer ? path.resolve(args.transformer) :
+ typeof config.getTransformModulePath === 'function' ? config.getTransformModulePath() :
+ undefined;
+
const options = {
projectRoots: config.getProjectRoots(),
assetExts: defaultAssetExts.concat(assetExts),
assetRoots: config.getAssetRoots(),
blacklistRE: config.getBlacklistRE(args.platform),
getTransformOptionsModulePath: config.getTransformOptionsModulePath,
- transformModulePath: args.transformer,
+ transformModulePath: transformModulePath,
extraNodeModules: config.extraNodeModules,
nonPersistent: true,
resetCache: args.resetCache,
@@ -18,8 +18,7 @@ module.exports = [
default: 'ios',
}, {
command: '--transformer [string]',
- description: 'Specify a custom transformer to be used (absolute path)',
- default: require.resolve('../../packager/transformer'),
+ description: 'Specify a custom transformer to be used',
}, {
command: '--dev [boolean]',
description: 'If false, warnings are disabled and the bundle is minified',
@@ -89,7 +89,6 @@ module.exports = {
description: 'The platform extension used for selecting modules',
}, {
command: '--transformer [path]',
- default: null,
description: 'Specify a custom transformer to be used'
}, {
command: '--verbose',
@@ -109,8 +109,7 @@ module.exports = {
description: 'Disable file watcher'
}, {
command: '--transformer [string]',
- default: require.resolve('../../packager/transformer'),
- description: 'Specify a custom transformer to be used (absolute path)'
+ description: 'Specify a custom transformer to be used'
}, {
command: '--reset-cache, --resetCache',
description: 'Removes cached files',

1 comment on commit 111ed8d

@aleclarson
Contributor
aleclarson commented on 111ed8d Oct 17, 2016 edited

Why remove the default value for --transformer?

Edit: Nevermind. I see it's in default.config.js so we're all good.

Please sign in to comment.