kristerkari/react-native-svg-transformer

question - should we install "metro-config"?

Adnan-Bacic opened this issue · 1 comments

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?

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.