Skip to content

Commit 111ed8d

Browse files
philikonFacebook Github Bot 0
authored andcommitted
Allow rn-cli.config.js to specify the default transformer, again
Summary: Restores feature introduced in facebook#7961 after it's been paved partially by facebook#7899 **Test Plan:** ran example in https://github.com/philikon/ReactNativify against a React Native with and without this patch Closes facebook#9799 Differential Revision: D3852601 Pulled By: mkonicek fbshipit-source-id: fc3c80bdb254145fefa870eea1828b4ef33f9297
1 parent 4ab455b commit 111ed8d

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

local-cli/bundle/buildBundle.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,18 @@ function buildBundle(args, config, output = outputBundle, packagerInstance) {
4040
if (!packagerInstance) {
4141
let assetExts = (config.getAssetExts && config.getAssetExts()) || [];
4242

43+
const transformModulePath =
44+
args.transformer ? path.resolve(args.transformer) :
45+
typeof config.getTransformModulePath === 'function' ? config.getTransformModulePath() :
46+
undefined;
47+
4348
const options = {
4449
projectRoots: config.getProjectRoots(),
4550
assetExts: defaultAssetExts.concat(assetExts),
4651
assetRoots: config.getAssetRoots(),
4752
blacklistRE: config.getBlacklistRE(args.platform),
4853
getTransformOptionsModulePath: config.getTransformOptionsModulePath,
49-
transformModulePath: args.transformer,
54+
transformModulePath: transformModulePath,
5055
extraNodeModules: config.extraNodeModules,
5156
nonPersistent: true,
5257
resetCache: args.resetCache,

local-cli/bundle/bundleCommandLineArgs.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ module.exports = [
1818
default: 'ios',
1919
}, {
2020
command: '--transformer [string]',
21-
description: 'Specify a custom transformer to be used (absolute path)',
22-
default: require.resolve('../../packager/transformer'),
21+
description: 'Specify a custom transformer to be used',
2322
}, {
2423
command: '--dev [boolean]',
2524
description: 'If false, warnings are disabled and the bundle is minified',

local-cli/dependencies/dependencies.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ module.exports = {
8989
description: 'The platform extension used for selecting modules',
9090
}, {
9191
command: '--transformer [path]',
92-
default: null,
9392
description: 'Specify a custom transformer to be used'
9493
}, {
9594
command: '--verbose',

local-cli/server/server.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ module.exports = {
109109
description: 'Disable file watcher'
110110
}, {
111111
command: '--transformer [string]',
112-
default: require.resolve('../../packager/transformer'),
113-
description: 'Specify a custom transformer to be used (absolute path)'
112+
description: 'Specify a custom transformer to be used'
114113
}, {
115114
command: '--reset-cache, --resetCache',
116115
description: 'Removes cached files',

0 commit comments

Comments
 (0)