How to use the @expo/config.projectHasModule 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 / webpack-config / src / addons / withEntry.ts View on Github external
export default function withEntry(
  webpackConfig: AnyConfiguration,
  env: InputEnvironment = {},
  options: { entryPath: string; strict?: boolean }
): AnyConfiguration {
  env.projectRoot = env.projectRoot || getPossibleProjectRoot();

  const extraAppEntry = projectHasModule(
    options.entryPath,
    env.projectRoot,
    // @ts-ignore
    env.config || getConfig(env)
  );

  if (!extraAppEntry) {
    if (options.strict) {
      throw new Error(
        `[WEBPACK]: The required app entry module: "${options.entryPath}" couldn't be found.`
      );
    }
    // Couldn't resolve the app entry so return the config without modifying it.
    return webpackConfig;
  }
github expo / expo-cli / packages / webpack-config / src / webpack.config.ts View on Github external
const babelProjectRoot = babelAppConfig.root || locations.root;

  const appEntry: string[] = [];

  // In solutions like Gatsby the main entry point doesn't need to be known.
  if (locations.appMain) {
    appEntry.push(locations.appMain);
  } else {
    throw new Error(
      `The entry point for your project couldn't be found. Please define it in the package.json main field`
    );
  }

  // Add a loose requirement on the ResizeObserver polyfill if it's installed...
  // Avoid `withEntry` as we don't need so much complexity with this config.
  const resizeObserverPolyfill = projectHasModule(
    'resize-observer-polyfill/dist/ResizeObserver.global',
    env.projectRoot,
    config
  );
  if (resizeObserverPolyfill) {
    appEntry.unshift(resizeObserverPolyfill);
  }

  if (isDev) {
    // https://github.com/facebook/create-react-app/blob/e59e0920f3bef0c2ac47bbf6b4ff3092c8ff08fb/packages/react-scripts/config/webpack.config.js#L144
    // Include an alternative client for WebpackDevServer. A client's job is to
    // connect to WebpackDevServer by a socket and get notified about changes.
    // When you save a file, the client will either apply hot updates (in case
    // of CSS changes), or refresh the page (in case of JS changes). When you
    // make a syntax error, this client will display a syntax error overlay.
    // Note: instead of the default WebpackDevServer client, we use a custom one
github expo / expo-cli / packages / electron-adapter / src / Config.ts View on Github external
    dependency => !projectHasModule(dependency.split('@^').shift()!, projectRoot, {})
  );
github expo / expo-cli / packages / electron-adapter / src / Config.ts View on Github external
    dependency => !projectHasModule(dependency, projectRoot, {})
  );
github expo / expo-cli / packages / next-adapter / src / customize / manifest.ts View on Github external
    dependency => !projectHasModule(dependency, projectRoot, {})
  );