Skip to content

Instantly share code, notes, and snippets.

@trooperandz
Created October 18, 2020 23:00
Show Gist options
  • Save trooperandz/f5ab3ebb5aac2bf1493e3372384ff8c5 to your computer and use it in GitHub Desktop.
Save trooperandz/f5ab3ebb5aac2bf1493e3372384ff8c5 to your computer and use it in GitHub Desktop.
React Native SVG Configuration
/**
* Metro configuration for React Native with svg support
* https://github.com/facebook/react-native
*
* @format
*/
const { getDefaultConfig } = require('metro-config');
module.exports = (async () => {
const {
resolver: { sourceExts, assetExts },
} = await getDefaultConfig();
return {
transformer: {
babelTransformerPath: require.resolve('react-native-svg-transformer'),
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
resolver: {
assetExts: assetExts.filter(ext => ext !== 'svg'),
sourceExts: [...sourceExts, 'svg'],
},
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment