mirror of https://github.com/status-im/metro.git
Fixes various issues on the Metro CLI
Reviewed By: rafeca Differential Revision: D6407718 fbshipit-source-id: 871dd77fad4fcf8f6b0fa628bacc0dfb6cb51484
This commit is contained in:
parent
319220d870
commit
167bda72b0
|
@ -27,6 +27,8 @@ import type {TransformVariants} from './ModuleGraph/types.flow';
|
|||
import type {HasteImpl} from './node-haste/Module';
|
||||
|
||||
export type ConfigT = {
|
||||
assetRegistryPath: string,
|
||||
|
||||
extraNodeModules: {[id: string]: string},
|
||||
/**
|
||||
* Specify any additional asset file extensions to be used by the packager.
|
||||
|
@ -140,6 +142,7 @@ export type ConfigT = {
|
|||
};
|
||||
|
||||
const DEFAULT = ({
|
||||
assetRegistryPath: 'missing-asset-registry-path',
|
||||
extraNodeModules: {},
|
||||
assetTransforms: false,
|
||||
getAssetExts: () => [],
|
||||
|
|
|
@ -74,7 +74,7 @@ async function asyncRealpath(path): Promise<string> {
|
|||
async function runMetro({
|
||||
config,
|
||||
maxWorkers = 1,
|
||||
projectRoots,
|
||||
projectRoots = [],
|
||||
watch = false,
|
||||
}: PrivateMetroOptions) {
|
||||
const normalizedConfig = config ? normalizeConfig(config) : DEFAULT_CONFIG;
|
||||
|
@ -97,7 +97,7 @@ async function runMetro({
|
|||
|
||||
const serverOptions: ServerOptions = {
|
||||
assetExts: defaultAssetExts.concat(assetExts),
|
||||
assetRegistryPath: `invalid`,
|
||||
assetRegistryPath: normalizedConfig.assetRegistryPath,
|
||||
blacklistRE: normalizedConfig.getBlacklistRE(),
|
||||
extraNodeModules: normalizedConfig.extraNodeModules,
|
||||
getPolyfills: normalizedConfig.getPolyfills,
|
||||
|
@ -237,12 +237,13 @@ exports.runBuild = async (options: RunBuildOptions) => {
|
|||
const metroBundle = await MetroBundler.build(metroServer, requestOptions);
|
||||
|
||||
const outputOptions: OutputOptions = {
|
||||
bundleOutput: options.out,
|
||||
bundleOutput: options.out.replace(/(\.js)?$/, '.js'),
|
||||
dev: options.dev,
|
||||
platform: options.platform || `web`,
|
||||
};
|
||||
|
||||
await MetroBundler.save(metroBundle, outputOptions, console.log);
|
||||
await metroServer.end();
|
||||
|
||||
return {metroServer, metroBundle};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue