Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion local-cli/bundle/buildBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions local-cli/bundle/bundleCommandLineArgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable and simple that I think I can merge this. Just one question - why remove the default here? Could it break any code relying on the default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the default for command line arguments is pricely the point here (and the fact that #7899 added them again is the regression from #7961). We want the transformer to be specified as followed:

  1. If specified on command line, use that
  2. If specified by rn-cli.config.js, use that
  3. Fallback to default configuration

For this fallback chain to work properly, there must not be a default value returned by the command line parser, otherwise we stop at (1) and never make it to (2).

command: '--dev [boolean]',
description: 'If false, warnings are disabled and the bundle is minified',
Expand Down
1 change: 0 additions & 1 deletion local-cli/dependencies/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 1 addition & 2 deletions local-cli/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down