skip to Main Content

Tis is my first app in Expo (React Native) so I have no idea why this is happening. This is the output after "npx expo prebuild":

✔ Cleared android, ios code
✔ Created native projects | gitignore skipped
› Metro skipped: Project metro.config.js does not match prebuild template.
› Ensure the project uses @expo/metro-config.
  Learn more
✔ Updated package.json and added index.js entry point for iOS and Android
› Installing using npm
» android: userInterfaceStyle: Install expo-system-ui in your project to enable this feature.
✔ Config synced
✔ Installed pods and initialized Xcode workspace.

this is my metro.config.file:

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

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

this is the metro config I always had during development so if you can point me in the right direction I would appreciate it.

3

Answers


  1. Chosen as BEST ANSWER

    Ok I solved it by adding:

    assetPlugins: ["expo-asset/tools/hashAssetFiles"]

    Like this:

    const { getDefaultConfig } = require("metro-config");
    
       module.exports = (async () => {
            const {
               resolver: { sourceExts, assetExts },
            } = await getDefaultConfig();
    
    return {
        transformer: {
            babelTransformerPath: require.resolve("react-native-  svg-transformer"),
            assetPlugins: ["expo-asset/tools/hashAssetFiles"],
        },
        resolver: {
            assetExts: assetExts.filter((ext) => ext !== "svg"),
            sourceExts: [...sourceExts, "svg"],
        },
    };
    })();
    

  2. "Ensure the project uses @expo/metro-config."

    So, replace const { getDefaultConfig } = require("metro-config"); with const { getDefaultConfig } = require('@expo/metro-config')

    Login or Signup to reply.
  3. change const { getDefaultConfig } = require("metro-config");

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

    From double to single quotes

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search