How to use the @expo/config/paths.getManagedExtensions function in @expo/config

To help you get started, we’ve selected a few @expo/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 expo / expo-cli / packages / xdl / src / Project.ts View on Github external
_assertValidProjectRoot(projectRoot);
  await stopReactNativeServerAsync(projectRoot);
  await Watchman.addToPathAsync(); // Attempt to fix watchman if it's hanging
  await Watchman.unblockAndGetVersionAsync(projectRoot);

  let { exp } = await readConfigJsonAsync(projectRoot);

  let packagerPort = await _getFreePortAsync(19001); // Create packager options

  const customLogReporterPath: string = require.resolve(path.join(__dirname, 'reporter'));

  let packagerOpts: { [key: string]: any } = {
    port: packagerPort,
    customLogReporterPath,
    // TODO: Bacon: Support .mjs (short-lived JS modules extension that some packages use)
    sourceExts: getManagedExtensions([], { isTS: true, isReact: true, isModern: false }),
  };

  if (options.nonPersistent && Versions.lteSdkVersion(exp, '32.0.0')) {
    packagerOpts.nonPersistent = true;
  }

  if (Versions.gteSdkVersion(exp, '33.0.0')) {
    packagerOpts.assetPlugins = resolveModule('expo/tools/hashAssetFiles', projectRoot, exp);
  }

  if (options.maxWorkers) {
    packagerOpts['max-workers'] = options.maxWorkers;
  }

  if (!Versions.gteSdkVersion(exp, '16.0.0')) {
    delete packagerOpts.customLogReporterPath;
github expo / expo-cli / packages / webpack-config / src / env / extensions.ts View on Github external
export function getModuleFileExtensions(...platforms: string[]): string[] {
  // Webpack requires a `.` before each value
  return getManagedExtensions(platforms).map(value => `.${value}`);
}
github expo / expo-cli / packages / next-adapter / src / withExpo.ts View on Github external
export default function withExpo(nextConfig: NextConfig = {}): NextConfig {
  return {
    ...nextConfig,
    pageExtensions: getManagedExtensions(['web']),
    webpack(config: AnyConfiguration, options: any): AnyConfiguration {
      const expoConfig = withUnimodules(
        config,
        {
          projectRoot: nextConfig.projectRoot || process.cwd(),
        },
        { supportsFontLoading: false }
      );
      // Use original public path
      (expoConfig.output || {}).publicPath = (config.output || {}).publicPath;

      // TODO: Bacon: use commonjs for RNW babel maybe...
      if (typeof nextConfig.webpack === 'function') {
        return nextConfig.webpack(expoConfig, options);
      }
github expo / expo / packages / jest-expo / config / getPlatformPreset.js View on Github external
function getPlatformPreset(displayOptions, extensions) {
  const moduleFileExtensions = getManagedExtensions(extensions);
  const testMatch = ['', ...extensions].reduce((arr, cur) => {
    const platformExtension = cur ? `.${cur}` : '';
    const sourceExtension = `.[jt]s?(x)`;
    return [
      ...arr,
      `**/__tests__/**/*spec${platformExtension}${sourceExtension}`,
      `**/__tests__/**/*test${platformExtension}${sourceExtension}`,
      `**/?(*.)+(spec|test)${platformExtension}${sourceExtension}`,
    ];
  }, []);

  return withWatchPlugins({
    displayName: displayOptions,
    testMatch,
    moduleFileExtensions,
    snapshotResolver: require.resolve(`../src/snapshot/resolver.${extensions[0]}.js`),
github expo / expo-cli / packages / webpack-config / getWebExtensions.js View on Github external
module.exports = function getWebExtensions() {
  return getManagedExtensions(['web']);
};