Skip to content

Commit

Permalink
metro-bundler: remove hardcoded AssetRegistry path
Browse files Browse the repository at this point in the history
Reviewed By: davidaurelio

Differential Revision: D5452553

fbshipit-source-id: e0a6f56d3bc03f4ba7f34fbee1ae418495dcc6cd
  • Loading branch information
Jean Lauliac authored and facebook-github-bot committed Jul 25, 2017
1 parent fc38fe1 commit 65769b0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions local-cli/bundle/buildBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const defaultSourceExts = require('metro-bundler/src/defaults').sourceExts;
const defaultPlatforms = require('metro-bundler/src/defaults').platforms;
const defaultProvidesModuleNodeModules = require('metro-bundler/src/defaults').providesModuleNodeModules;

const {ASSET_REGISTRY_PATH} = require('../core/Constants');

import type {RequestOptions, OutputOptions} from './types.flow';
import type {ConfigT} from '../util/Config';

Expand Down Expand Up @@ -85,6 +87,7 @@ function buildBundle(
const terminal = new Terminal(process.stdout);
const options = {
assetExts: defaultAssetExts.concat(assetExts),
assetRegistryPath: ASSET_REGISTRY_PATH,
blacklistRE: config.getBlacklistRE(),
extraNodeModules: config.extraNodeModules,
getPolyfills: config.getPolyfills,
Expand Down
17 changes: 17 additions & 0 deletions local-cli/core/Constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @flow
* @format
*/

'use strict';

const ASSET_REGISTRY_PATH = 'react-native/Libraries/Image/AssetRegistry';

module.exports = {ASSET_REGISTRY_PATH};
3 changes: 3 additions & 0 deletions local-cli/server/runServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const webSocketProxy = require('./util/webSocketProxy.js');

const TransformCaching = require('metro-bundler/src/lib/TransformCaching');

const {ASSET_REGISTRY_PATH} = require('../core/Constants');

import type {ConfigT} from '../util/Config';
import type {Reporter} from 'metro-bundler/src/lib/reporting';

Expand Down Expand Up @@ -147,6 +149,7 @@ function getPackagerServer(args, config) {
const terminal = new Terminal(process.stdout);
return ReactPackager.createServer({
assetExts: defaultAssetExts.concat(args.assetExts),
assetRegistryPath: ASSET_REGISTRY_PATH,
blacklistRE: config.getBlacklistRE(),
cacheVersion: '3',
extraNodeModules: config.extraNodeModules,
Expand Down

0 comments on commit 65769b0

Please sign in to comment.