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

Metro/expo config makes google fonts stop working #114

Closed
aas395 opened this issue Dec 21, 2020 · 1 comment
Closed

Metro/expo config makes google fonts stop working #114

aas395 opened this issue Dec 21, 2020 · 1 comment

Comments

@aas395
Copy link

aas395 commented Dec 21, 2020

I installed the react-native-svg-transformer package according to the directions. My app is also using these three packages:

"@expo-google-fonts/nunito-sans": "^0.1.0",
"@expo-google-fonts/roboto": "^0.1.0",
"@expo-google-fonts/source-sans-pro": "^0.1.0",

After creating the metro.config.js file and updating app.json, my app crashes on reload with this error: 'Unrecognized font family 'NunitoSans_900Black'. This font resolved fine before adding the transformer package.

It looks like the issue has something to do with the new metro config settings. Any thoughts on what could be going on? Thank you for any help you can provide!

@aas395
Copy link
Author

aas395 commented Dec 31, 2020

Seems to be related to this issue: expo/expo#11333

This config works for me:

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

const defaultConfig = getDefaultConfig(__dirname);

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

Suggest updating the docs at some point to reflect the new config requirements.

@aas395 aas395 closed this as completed Dec 31, 2020
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