Pass the maxWorkers config param correctly to Metro
Summary: @public The React Native CLI is not passing the default `maxWorkers` param to Metro, making it run in a single thread and making the development process really slow. This fixes https://github.com/facebook/metro/issues/253 Reviewed By: mjesun Differential Revision: D9915500 fbshipit-source-id: d15030af582e99fe20535c07e751cfe12e444f2f
This commit is contained in:
parent
68c7999c25
commit
7a69f1aa27
|
@ -32,8 +32,8 @@ module.exports = {
|
|||
options: [
|
||||
{
|
||||
command: '--port [number]',
|
||||
default: process.env.RCT_METRO_PORT || 8081,
|
||||
parse: (val: string) => Number(val),
|
||||
default: (config: ConfigT) => config.server.port,
|
||||
},
|
||||
{
|
||||
command: '--host [string]',
|
||||
|
@ -42,18 +42,14 @@ module.exports = {
|
|||
{
|
||||
command: '--projectRoot [string]',
|
||||
description: 'Specify the main project root',
|
||||
default: (config: ConfigT) => {
|
||||
return config.projectRoot;
|
||||
},
|
||||
default: (config: ConfigT) => config.projectRoot,
|
||||
},
|
||||
{
|
||||
command: '--watchFolders [list]',
|
||||
description:
|
||||
'Specify any additional folders to be added to the watch list',
|
||||
parse: (val: string) => val.split(','),
|
||||
default: (config: ConfigT) => {
|
||||
return config.watchFolders;
|
||||
},
|
||||
default: (config: ConfigT) => config.watchFolders,
|
||||
},
|
||||
{
|
||||
command: '--assetExts [list]',
|
||||
|
@ -81,11 +77,7 @@ module.exports = {
|
|||
description:
|
||||
'Specify any npm packages that import dependencies with providesModule',
|
||||
parse: (val: string) => val.split(','),
|
||||
default: (config: RNConfig) => {
|
||||
return config.resolver
|
||||
? config.resolver.providesModuleNodeModules
|
||||
: undefined;
|
||||
},
|
||||
default: (config: ConfigT) => config.resolver.providesModuleNodeModules,
|
||||
},
|
||||
{
|
||||
command: '--max-workers [number]',
|
||||
|
@ -93,6 +85,7 @@ module.exports = {
|
|||
'Specifies the maximum number of workers the worker-pool ' +
|
||||
'will spawn for transforming files. This defaults to the number of the ' +
|
||||
'cores available on your machine.',
|
||||
default: (config: ConfigT) => config.maxWorkers,
|
||||
parse: (workers: string) => Number(workers),
|
||||
},
|
||||
{
|
||||
|
|
|
@ -76,6 +76,9 @@ const Config = {
|
|||
],
|
||||
getPolyfills,
|
||||
},
|
||||
server: {
|
||||
port: process.env.RCT_METRO_PORT || 8081,
|
||||
},
|
||||
transformer: {
|
||||
babelTransformerPath: require.resolve('metro/src/reactNativeTransformer'),
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue