metro-bundler: remove hardcoded AssetRegistry path

Reviewed By: davidaurelio

Differential Revision: D5452553

fbshipit-source-id: e0a6f56d3bc03f4ba7f34fbee1ae418495dcc6cd
This commit is contained in:
Jean Lauliac 2017-07-24 17:04:38 -07:00 коммит произвёл Facebook Github Bot
Родитель fc38fe1736
Коммит 65769b0c33
3 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -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';
@ -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,

Просмотреть файл

@ -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};

Просмотреть файл

@ -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';
@ -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,