Skip to content

Commit

Permalink
Fix #17610, Add fixtures to metro blacklist
Browse files Browse the repository at this point in the history
Summary:
Include a default blacklist into the build settings to prevent
processing of incorrect fixture files by Metro.

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

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 #17672

Differential Revision: D7014627

Pulled By: hramos

fbshipit-source-id: 20974e6fdd0977eeeb1048c29c9d621c803c26e9
  • Loading branch information
t4deu authored and facebook-github-bot committed Feb 17, 2018
1 parent da3424c commit 54dc11a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion local-cli/util/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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';

Expand Down Expand Up @@ -54,6 +54,10 @@ const getProjectRoots = () => {
return resolveSymlinksForRoots([getProjectPath()]);
};

const getBlacklistRE = () => {
return createBlacklist([/.*\/__fixtures__\/.*/]);
};

/**
* Module capable of getting the configuration out of a given file.
*
Expand All @@ -65,6 +69,7 @@ const getProjectRoots = () => {
const Config = {
DEFAULT: ({
...MetroConfig.DEFAULT,
getBlacklistRE,
getProjectRoots,
getPolyfills,
getModulesRunBeforeMainModule: () => [
Expand Down

0 comments on commit 54dc11a

Please sign in to comment.