How to use the @expo/webpack-config/addons.withUnimodules 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 / next-adapter / src / withExpo.ts View on Github external
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);
      }

      return expoConfig;
    },
github slorber / gatsby-plugin-react-native-web / src / gatsby-node.js View on Github external
function onCreateWebpackConfig({ actions, getConfig }) {
  const gatsbyConfig = getConfig()
  if (!gatsbyConfig.context) {
    throw new Error('Expected Gatsby config to provide the root context')
  }

  let config
  try {
    config = withUnimodules(gatsbyConfig)
  } catch (error) {
    console.error(error)
    process.exit(1)
  }

  actions.replaceWebpackConfig(config)
}
github expo / expo-cli / packages / xdl / src / Webpack.ts View on Github external
async function createWebpackConfigAsync(
  env: Web.WebEnvironment,
  options: CLIWebOptions = {}
): Promise {
  setMode(env.mode);

  let config;
  if (options.unimodulesOnly) {
    const { withUnimodules } = require('@expo/webpack-config/addons');
    config = withUnimodules({}, env);
  } else {
    config = await Web.invokeWebpackConfigAsync(env);
  }

  return config;
}