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 https://github.com/facebook/react-native/pull/9799 Differential Revision: D3852601 Pulled By: mkonicek fbshipit-source-id: fc3c80bdb254145fefa870eea1828b4ef33f9297
This commit is contained in:
Родитель
4ab455b37d
Коммит
111ed8d180
|
@ -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',
|
||||
|
|
Загрузка…
Ссылка в новой задаче