kristerkari / react-native-svg-transformer

Import SVG files in your React Native project the same way that you would in a Web application.
MIT License
1.57k stars 116 forks source link

question - should we install "metro-config"? #176

Closed Adnan-Bacic closed 2 years ago

Adnan-Bacic commented 2 years ago

something i have been unsure about for a while. but when using react-native-svg and react-native-svg-transformer, the documentation imports something from metro-config, like so:

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

however neither documentation actually say you have to install metro-config first. when i search the project i see that metro-config is already a dependency of @react-native-community/cli. that package itself is a dependency of react-native. so by default we always have metro-config in our project. so we dont NEED to install it.

so since i usually install metro-config i feel like also have to remember to update it whenever i update react-native so the versions match. this adds potentially unneeded manual work(that i may forget). however if i dont install it, it should just use the version react-native uses, solving the problem of updating versions. maybe its not even needed that the versions match?

so basically, should we install metro-config, or just rely on the version that our version of react-native uses?

kristerkari commented 2 years ago

I would recommend to use the version that comes shipped with react-native.

It might be that if you install your own version, react-native will anyway use it's own version instead of the one that you have installed.