Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module 'react-native-svg-transformer/expo' #389

Open
YANGHYUK opened this issue Nov 2, 2024 · 1 comment
Open

Error: Cannot find module 'react-native-svg-transformer/expo' #389

YANGHYUK opened this issue Nov 2, 2024 · 1 comment

Comments

@YANGHYUK
Copy link

YANGHYUK commented Nov 2, 2024

I'm trying to build expo with this command.
eas build --profile production --platform android --local
it failed with proguard. (but without proguard , it succeeds. eas build --profile preview --platform android --local )

eas.json

"preview": {
      "env": {
        "EXPO_PUBLIC_API_URL": "***********",
        "NODE_ENV": "development"
      },
      "android": {
        "buildType": "apk"
      },
      "distribution": "internal",
      "channel": "preview"
    },
 "production": {
      "env": {
        "EXPO_PUBLIC_API_URL": "***********",
        "NODE_ENV": "production"
      },
      "android": {
        "buildType": "app-bundle",
        "distribution": "internal",
        "env": {
          "PROGUARD_ENABLED": "true"
        }
      },
      "channel": "production"
    }
    

app.json

"plugins": [
      [
        "expo-build-properties",
        {
          "android": {
            "enableProguardInReleaseBuilds": true,
            "extraProguardRules": "-keep public class com.horcrux.svg.** {*;}"
          }
        }
      ]
    ],

metro.config.js

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

module.exports = (() => {
  const config = getDefaultConfig(__dirname);

  const { transformer, resolver } = config;

  config.transformer = {
    ...transformer,
    babelTransformerPath: require.resolve('react-native-svg-transformer/expo'),
  };
  config.resolver = {
    ...resolver,
    assetExts: resolver.assetExts.filter((ext) => ext !== 'svg'),
    sourceExts: [...resolver.sourceExts, 'svg'],
  };

  return config;
})();

whole error!

image

@YANGHYUK
Copy link
Author

YANGHYUK commented Nov 2, 2024

"NODE_ENV": "production"

I found something weird.
when i remove "NODE_ENV": "production"

Build is successful.

 "production": {
      "env": {
        "EXPO_PUBLIC_API_URL": "******"
        // "NODE_ENV": "production" => remove
      },
      "android": {
        "buildType": "apk",
        "env": {
          "PROGUARD_ENABLED": "true"
        }
      },
      "distribution": "internal",
      "channel": "production"
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant