Skip to content

Instantly share code, notes, and snippets.

@IgorMing
Created October 14, 2020 22:29
Show Gist options
  • Save IgorMing/55dc8bdb0b1cd7f0ea65249befda09f5 to your computer and use it in GitHub Desktop.
Save IgorMing/55dc8bdb0b1cd7f0ea65249befda09f5 to your computer and use it in GitHub Desktop.
required configuration for load svg files into your react native project
const { getDefaultConfig } = require('metro-config');
module.exports = (async () => {
const {
resolver: { sourceExts, assetExts }
} = await getDefaultConfig();
return {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false
}
}),
babelTransformerPath: require.resolve('react-native-svg-transformer')
},
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