From 2a4150948057968756a45dc829ae87254a4ccfc5 Mon Sep 17 00:00:00 2001 From: Tadeu Valentt Date: Fri, 16 Feb 2018 20:39:27 -0800 Subject: [PATCH] Fix #17610, Add fixtures to metro blacklist Summary: Include a default blacklist into the build settings to prevent processing of incorrect fixture files by Metro. Fix #17610 issue, preventing metro from processing fixture files 1. Have a working demo 2. Install https://github.com/oblador/react-native-vector-icons 3. Use in a component 4. Start the app 5. The app starts successfully and display the icons [ GENERAL ] [ BUGFIX ] [local-cli/util/Config.js] - Add default file blacklist Closes https://github.com/facebook/react-native/pull/17672 Differential Revision: D7014627 Pulled By: hramos fbshipit-source-id: 20974e6fdd0977eeeb1048c29c9d621c803c26e9 --- local-cli/util/Config.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/local-cli/util/Config.js b/local-cli/util/Config.js index e57bdadc1f5..883e9f33a0b 100644 --- a/local-cli/util/Config.js +++ b/local-cli/util/Config.js @@ -17,7 +17,7 @@ const getPolyfills = require('../../rn-get-polyfills'); const invariant = require('fbjs/lib/invariant'); const path = require('path'); -const {Config: MetroConfig} = require('metro'); +const {Config: MetroConfig, createBlacklist} = require('metro'); const RN_CLI_CONFIG = 'rn-cli.config.js'; @@ -56,6 +56,10 @@ const getProjectRoots = () => { return resolveSymlinksForRoots([getProjectPath()]); }; +const getBlacklistRE = () => { + return createBlacklist([/.*\/__fixtures__\/.*/]); +}; + /** * Module capable of getting the configuration out of a given file. * @@ -67,6 +71,7 @@ const getProjectRoots = () => { const Config = { DEFAULT: ({ ...MetroConfig.DEFAULT, + getBlacklistRE, getProjectRoots, getPolyfills, getModulesRunBeforeMainModule: () => [