mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 20:01:01 +08:00
Use new configuration in react-native public cli
Summary: Change the public react-native CLI to use the new configuration of Metro. Reviewed By: rafeca Differential Revision: D8801217 fbshipit-source-id: 112e4812b430ebee1ed41489f803b90c182ccdb4
This commit is contained in:
committed by
Facebook Github Bot
parent
f0daaf3568
commit
a32620dc3b
@@ -14,15 +14,12 @@ const log = require('../util/log').out('bundle');
|
||||
/* $FlowFixMe(site=react_native_oss) */
|
||||
const Server = require('metro/src/Server');
|
||||
|
||||
const {convert} = require('metro-config');
|
||||
|
||||
/* $FlowFixMe(site=react_native_oss) */
|
||||
const outputBundle = require('metro/src/shared/output/bundle');
|
||||
const {convert} = require('metro-config');
|
||||
const path = require('path');
|
||||
const saveAssets = require('./saveAssets');
|
||||
|
||||
const {ASSET_REGISTRY_PATH} = require('../core/Constants');
|
||||
|
||||
import type {RequestOptions, OutputOptions} from './types.flow';
|
||||
import type {ConfigT} from 'metro-config/src/configTypes.flow';
|
||||
|
||||
@@ -48,6 +45,10 @@ async function buildBundle(
|
||||
sourceMapUrl = path.basename(sourceMapUrl);
|
||||
}
|
||||
|
||||
config.transformModulePath = args.transformer
|
||||
? path.resolve(args.transformer)
|
||||
: config.transformModulePath;
|
||||
|
||||
const requestOpts: RequestOptions = {
|
||||
entryFile: args.entryFile,
|
||||
sourceMapUrl,
|
||||
@@ -56,13 +57,6 @@ async function buildBundle(
|
||||
platform: args.platform,
|
||||
};
|
||||
|
||||
const transformModulePath = args.transformer
|
||||
? path.resolve(args.transformer)
|
||||
: config.transformModulePath;
|
||||
|
||||
config.transformModulePath = transformModulePath;
|
||||
config.transformer.assetRegistryPath = ASSET_REGISTRY_PATH;
|
||||
|
||||
const {serverOptions} = convert.convertNewToOld(config);
|
||||
|
||||
const server = new Server(serverOptions);
|
||||
|
||||
Reference in New Issue
Block a user