Skip to content

Commit

Permalink
Install and configure react-native-svg-transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham committed Dec 30, 2020
1 parent 0d41319 commit c472157
Show file tree
Hide file tree
Showing 3 changed files with 223 additions and 13 deletions.
35 changes: 22 additions & 13 deletions metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,25 @@
* @format
*/

module.exports = {
resolver: {
sourceExts: ['jsx', 'js', 'ts', 'tsx', 'json'],
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
const {getDefaultConfig} = require('metro-config');

module.exports = (async () => {
const {
resolver: {assetExts},
} = await getDefaultConfig();
return {
resolver: {
assetExts: assetExts.filter(ext => ext !== 'svg'),
sourceExts: ['jsx', 'js', 'ts', 'tsx', 'json', 'svg'],
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
babelTransformerPath: require.resolve('react-native-svg-transformer'),
},
};
})();
200 changes: 200 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"jest-cli": "^26.5.2",
"metro-react-native-babel-preset": "^0.61.0",
"react-hot-loader": "^4.12.21",
"react-native-svg-transformer": "^0.14.3",
"react-native-version": "^4.0.0",
"react-test-renderer": "16.13.1",
"webpack": "^4.44.1",
Expand Down

0 comments on commit c472157

Please sign in to comment.