How to use the metro-config/src/defaults/defaults.sourceExts 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 JetBrains / youtrack-mobile / metro.config.js View on Github external
*/

const defaultSourceExts = require('metro-config/src/defaults/defaults').sourceExts;

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
  resolver: {
    sourceExts: process.env.RN_SRC_EXT
      ? process.env.RN_SRC_EXT.split(',').concat(defaultSourceExts)
      : defaultSourceExts
  }
};
github celo-org / celo-monorepo / packages / mobile / rn-cli.config.js View on Github external
resolver: {
    blacklistRE: blacklist(
      isE2E ? blist : blist.concat([RegExp(`${escapedRoot}\/packages\/mobile\/e2e\/mocks/.*`)])
    ),
    extraNodeModules: {
      ...nodeLibs,
      'crypto-js': path.resolve(cwd, 'node_modules/crypto-js'),
      'isomorphic-fetch': require.resolve('cross-fetch'),
      net: require.resolve('react-native-tcp'),
      'react-native': path.resolve(cwd, 'node_modules/react-native'),
      'react-native-fs': path.resolve(cwd, 'node_modules/react-native-fs'),
      'react-native-screens': path.resolve(cwd, 'node_modules/react-native-screens'),
      'react-native-svg': path.resolve(cwd, 'node_modules/react-native-svg'),
      vm: require.resolve('vm-browserify'),
    },
    sourceExts: isE2E ? ['e2e.ts', 'e2e.js'].concat(defaultSourceExts) : defaultSourceExts,
  },

  watchFolders: [root],
}