mirror of
https://github.com/status-im/react-native.git
synced 2025-02-21 13:48:13 +00:00
Make config object read-only
Summary: This makes the Metro config type readonly, only a couple of things inside Metro needed to be tweaked :) Reviewed By: mjesun Differential Revision: D10028083 fbshipit-source-id: 15f5d957a8ee7384d6156c973639d86240fd251f
This commit is contained in:
parent
4052816467
commit
2c1057062e
@ -131,12 +131,16 @@ async function getCliConfig(): Promise<RNConfig> {
|
||||
cliArgs.config != null ? path.resolve(__dirname, cliArgs.config) : null,
|
||||
);
|
||||
|
||||
// $FlowFixMe Metro configuration is immutable.
|
||||
config.transformer.assetRegistryPath = ASSET_REGISTRY_PATH;
|
||||
// $FlowFixMe Metro configuration is immutable.
|
||||
config.resolver.hasteImplModulePath =
|
||||
config.resolver.hasteImplModulePath || defaultConfig.hasteImplModulePath;
|
||||
// $FlowFixMe Metro configuration is immutable.
|
||||
config.resolver.platforms = config.resolver.platforms
|
||||
? config.resolver.platforms.concat(defaultConfig.getPlatforms())
|
||||
: defaultConfig.getPlatforms();
|
||||
// $FlowFixMe Metro configuration is immutable.
|
||||
config.resolver.providesModuleNodeModules = config.resolver
|
||||
.providesModuleNodeModules
|
||||
? config.resolver.providesModuleNodeModules.concat(
|
||||
|
@ -54,12 +54,19 @@ async function runServer(args: Args, config: ConfigT) {
|
||||
|
||||
args.watchFolders.forEach(middlewareManager.serveStatic);
|
||||
|
||||
// $FlowFixMe Metro configuration is immutable.
|
||||
config.maxWorkers = args.maxWorkers;
|
||||
// $FlowFixMe Metro configuration is immutable.
|
||||
config.server.port = args.port;
|
||||
// $FlowFixMe Metro configuration is immutable.
|
||||
config.reporter = reporter;
|
||||
// $FlowFixMe Metro configuration is immutable.
|
||||
config.resetCache = args.resetCache;
|
||||
// $FlowFixMe Metro configuration is immutable.
|
||||
config.projectRoot = args.projectRoot;
|
||||
// $FlowFixMe Metro configuration is immutable.
|
||||
config.watchFolders = args.watchFolders.slice(0);
|
||||
// $FlowFixMe Metro configuration is immutable.
|
||||
config.server.enhanceMiddleware = middleware =>
|
||||
middlewareManager.getConnectInstance().use(middleware);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user