Custom metro.config.js in EAS

Hi,

we get the following error when building our project in EAS:

It looks like that you are using a custom metro.config.js that does not extend @expo/metro-config.

It kind of conflicts with:


That was included in the release notes for SDK 41.

Our metro.config.js looks like:

const { getDefaultConfig } = require("expo/metro-config");

module.exports = (async () => {
  const {
    resolver: { sourceExts, assetExts }
  } = await getDefaultConfig(__dirname);
  return {
    transformer: {
      babelTransformerPath: require.resolve("react-native-svg-transformer")
    },
    resolver: {
      assetExts: assetExts.filter(ext => ext !== "svg"),
      sourceExts: [...sourceExts, "svg"]
    }
  };
})();

Any ideas how to proceed?

Hi, this is explained in our docs here: Migrating from "expo build" - Expo Documentation

you need to export the entire default config, but you can make modifications to it. for example:

const { getDefaultConfig } = require('@expo/metro-config');

const defaultConfig = getDefaultConfig(__dirname);

defaultConfig.resolver.assetExts.push('db');

module.exports = defaultConfig;

@expo/metro-config and expo/metro-config are the same thing – expo/metro-config just re-exports the version of @expo/metro-config included in the expo package (which is done to version the package for you)

the key factor here is that you’re clobbering some configuration that is necessary. in particular, the assetPlugins are being removed because you’re clearing out any transformer configuration by only providing a single key babelTransformerPath and not spreading the default transformer options provided when you call getDefaultConfig