How to use the metro.createBlacklist function in metro

To help you get started, we’ve selected a few metro examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github invertase / react-native-firebase / tests / metro.config.js View on Github external
const { createBlacklist } = require('metro');
// const { mergeConfig } = require('metro-config');

const rootDir = resolve(__dirname, '..');
const packagesDir = resolve(rootDir, 'packages');

const isDirectory = source => statSync(source).isDirectory() && !source.includes('/template');
const firebaseModules = readdirSync(packagesDir)
  .map(name => join(packagesDir, name))
  .filter(isDirectory);

const config = {
  projectRoot: __dirname,
  resolver: {
    useWatchman: !process.env.TEAMCITY_VERSION,
    blackListRE: createBlacklist([
      /.*\/__fixtures__\/.*/,
      /.*\/template\/project\/node_modules\/react-native\/.*/,
      new RegExp(`^${escape(resolve(rootDir, 'docs'))}\\/.*$`),
      new RegExp(`^${escape(resolve(rootDir, 'tests/ios'))}\\/.*$`),
      new RegExp(`^${escape(resolve(rootDir, 'packages/template/project'))}\\/.*$`),
      new RegExp(`^${escape(resolve(rootDir, 'packages/template/project/node_modules'))}\\/.*$`),
      new RegExp(
        `^${escape(resolve(rootDir, 'packages/template/project/node_modules/react-native'))}\\/.*$`,
      ),
      new RegExp(`^${escape(resolve(rootDir, 'tests/e2e'))}\\/.*$`),
      new RegExp(`^${escape(resolve(rootDir, 'tests/android'))}\\/.*$`),
      new RegExp(`^${escape(resolve(rootDir, 'tests/functions'))}\\/.*$`),
    ]),
    extraNodeModules: new Proxy(
      {},
      {
github timfpark / react-native-location / tests / integration / metro.config.js View on Github external
const { resolve, join } = require("path");
const { createBlacklist } = require("metro");
const { mergeConfig } = require("metro-config");
const { DEFAULT } = require("react-native/local-cli/util/Config");

// https://github.com/facebook/react-native/blob/master/local-cli/core/Constants.js
// https://github.com/facebook/react-native/blob/master/local-cli/util/Config.js
const config = {
  resolver: {
    blackListRE: createBlacklist([
      new RegExp(
        `^${escape(resolve(__dirname, "..", "..", "node_modules"))}\\/.*$`
      )
    ]),
    extraNodeModules: new Proxy(
      {},
      {
        get: (target, name) => {
          if (name === "react-native-location") {
            return join(__dirname, `../../src`);
          }
          return join(__dirname, `node_modules/${name}`);
        }
      }
    ),
    platforms: ["android", "ios"]
github react-native-community / cli / util / Config.js View on Github external
const getBlacklistRE = () => {
  return createBlacklist([/.*\/__fixtures__\/.*/]);
};
github react-native-community / cli / packages / local-cli / util / Config.js View on Github external
const getBlacklistRE = () => {
  return createBlacklist([/.*\/__fixtures__\/.*/]);
};
github VirgilSecurity / virgil-e3kit-js / examples / ReactNativeSample / metro.config.js View on Github external
const { createBlacklist } = require('metro');

const rootDir = resolve(__dirname, '../..');
const packagesDir = resolve(rootDir, 'packages');

const isDirectory = source => statSync(source).isDirectory();
const virgilModules = readdirSync(packagesDir)
    .map(name => join(packagesDir, name))
    .filter(isDirectory);
const virgilPackageNames = virgilModules.map(path => basename(dirname(path)));

const config = {
    projectRoot: __dirname,
    resolver: {
        blackListRE: createBlacklist([
            new RegExp(
                `^${escape(
                    resolve(rootDir, 'examples/ReactNativeSample/android'),
                )}\\/.*$`,
            ),
            new RegExp(
                `^${escape(
                    resolve(rootDir, 'examples/ReactNativeSample/ios'),
                )}\\/.*$`,
            ),
            new RegExp(
                `^${escape(
                    resolve(rootDir, 'examples/ReactNativeSample/node_modules'),
                )}\\/.*$`,
            ),
        ]),