How to use the @expo/webpack-config/addons.withAlias function in @expo/webpack-config

To help you get started, we’ve selected a few @expo/webpack-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 / electron-adapter / src / Webpack.ts View on Github external
export function withExpoWebpack(
  config: AnyConfiguration,
  options: { projectRoot?: string; skipEntry?: boolean } = {}
) {
  // Support React Native aliases
  // @ts-ignore: webpack version mismatch
  config = withAlias(config);

  const projectRoot = options.projectRoot || process.cwd();

  const env: any = {
    platform: 'electron',
    projectRoot,
    mode: config.mode === 'production' ? config.mode : 'development',
    locations: getPaths(projectRoot),
  };
  if (!config.plugins) config.plugins = [];
  if (!config.resolve) config.resolve = {};

  env.config = getConfig(env);

  const [plugin] = getPluginsByName(config, 'HtmlWebpackPlugin');
  if (plugin) {