How to use the metro-config/src/defaults/defaults.sourceEtxs function in metro-config

To help you get started, we’ve selected a few metro-config 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 celo-org / celo-monorepo / packages / verifier / metro.config.js View on Github external
const cwd = path.resolve(__dirname)
const root = path.resolve(cwd, '../..')
const escapedRoot = escapeStringRegexp(root)
const celoRegex = new RegExp(`${escapedRoot}\/packages\/(?!verifier|utils|react-components).*`)
const nestedRnRegex = new RegExp(`.*\/node_modules\/.*\/node_modules\/react-native\/.*`)
const componentsRnRegex = new RegExp(`.*react-components\/node_modules\/(react-native)\/.*`)
const blacklistRE = blacklist([celoRegex, nestedRnRegex, componentsRnRegex])

module.exports = {
  resolver: {
    blacklistRE,
    extraNodeModules: {
      ...nodeLibs,
    },
    sourceEtxs: metroDefaults.sourceEtxs,
  },

  watchFolders: [root],
}