Permalink
Browse files

Export Config/defaults on Metro's main module

Reviewed By: arcanis

Differential Revision: D6435529

fbshipit-source-id: a9549dc5900025fcc798ccb92b49e96c982c2e1e
  • Loading branch information...
cpojer authored and facebook-github-bot committed Nov 29, 2017
1 parent 654fed4 commit 009149689119e180415f8138b2827366768fc1d3
Showing with 16 additions and 14 deletions.
  1. +9 −7 local-cli/bundle/buildBundle.js
  2. +7 −7 local-cli/server/runServer.js
@@ -29,25 +29,27 @@ const TerminalReporter = require('metro/src/lib/TerminalReporter');
* run Flow. */
const TransformCaching = require('metro/src/lib/TransformCaching');
const {defaults} = require('metro');
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
const outputBundle = require('metro/src/shared/output/bundle');
const path = require('path');
const saveAssets = require('./saveAssets');
const defaultAssetExts = require('metro/src/defaults').assetExts;
const defaultSourceExts = require('metro/src/defaults').sourceExts;
const defaultPlatforms = require('metro/src/defaults').platforms;
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
const defaultProvidesModuleNodeModules = require('metro/src/defaults').providesModuleNodeModules;
const {ASSET_REGISTRY_PATH} = require('../core/Constants');
import type {RequestOptions, OutputOptions} from './types.flow';
import type {ConfigT} from 'metro';
const defaultAssetExts = defaults.assetExts;
const defaultSourceExts = defaults.sourceExts;
const defaultPlatforms = defaults.platforms;
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
const defaultProvidesModuleNodeModules = defaults.providesModuleNodeModules;
async function buildBundle(
args: OutputOptions & {
assetsDest: mixed,
@@ -16,7 +16,7 @@ require('../../setupBabel')();
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
const ReactPackager = require('metro');
const Metro = require('metro');
const HmrServer = require('metro/src/HmrServer');
@@ -31,14 +31,14 @@ const attachWebsocketServer = require('./util/attachWebsocketServer');
* run Flow. */
const connect = require('connect');
const copyToClipBoardMiddleware = require('./middleware/copyToClipBoardMiddleware');
const defaultAssetExts = require('metro/src/defaults').assetExts;
const defaultSourceExts = require('metro/src/defaults').sourceExts;
const defaultPlatforms = require('metro/src/defaults').platforms;
const defaultAssetExts = Metro.defaults.assetExts;
const defaultSourceExts = Metro.defaults.sourceExts;
const defaultPlatforms = Metro.defaults.platforms;
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
const defaultProvidesModuleNodeModules = require('metro/src/defaults')
.providesModuleNodeModules;
const defaultProvidesModuleNodeModules =
Metro.defaults.providesModuleNodeModules;
const fs = require('fs');
const getDevToolsMiddleware = require('./middleware/getDevToolsMiddleware');
const http = require('http');
@@ -178,7 +178,7 @@ function getPackagerServer(args, config, reporter) {
const providesModuleNodeModules =
args.providesModuleNodeModules || defaultProvidesModuleNodeModules;
return ReactPackager.createServer({
return Metro.createServer({
assetExts: defaultAssetExts.concat(args.assetExts),
assetRegistryPath: ASSET_REGISTRY_PATH,
blacklistRE: config.getBlacklistRE(),

2 comments on commit 0091496

@janicduplessis

This comment has been minimized.

Collaborator

janicduplessis replied Dec 1, 2017

@cpojer Could you do a metro release, this currently breaks rn master since the export doesn’t exist in the latest published metro version.

@cpojer

This comment has been minimized.

Contributor

cpojer replied Dec 4, 2017

Will do today.

Please sign in to comment.