maxkomarychev / react-native-ultimate-config

Config that works
MIT License
261 stars 31 forks source link

fix: add default `override` file #57

Closed xxsnakerxx closed 2 years ago

xxsnakerxx commented 3 years ago

It prevents errors after re-installing dependencies

Screen Shot 2021-04-23 at 3 37 57 PM
maxkomarychev commented 3 years ago

hi!

Do you use js_override in your rnucrc.js?

First of all - thanks for the contribution,

I tend to disagree with this approach: the library relies heavily on codegeneration. normally when dependencies are reinstalled code gets wiped and environment must be initialized again - this is kind of by design . I would prefer it tell me I need to inject variables rather than think they are still correct when in fact they are undefined.

xxsnakerxx commented 3 years ago

I use the js_override but it's false. If I don't need the overriding feature the library shouldn't break my app after reinstalling dependencies.

Maybe create folder override with its own index.js which will import override.js

So, if I don't need the overriding feature I do

import env from 'react-native-ultimate-config';

If I need overriding, then

import env from 'react-native-ultimate-config/override';

and js_override can be removed