Why is wildcard import not supported? #214
Replies: 3 comments 2 replies
|
This is the best practice because env can be very extensive. On a per-component basis, it's a lot of information that can couple the component to the project. If you want, you can abstract your dotenv as dotenv is really just supposed to be a way to help with enabling environment variables, not permeating config throughout your project. |
Did you implement your own update to this? I'm also doing something similar: // constants.js
// import { SOME_CONFIG_KEY as ENV_SOME_CONFIG_KEY } from '@env'; // this is a large list
import * as env from '@env';
// can be reversed
const SOME_CONFIG_KEY = (env.SOME_CONFIG_KEY) ?
(env.SOME_CONFIG_KEY) :
config.get('someConfigKey'); // config from remote config
export { ..., SOME_CONFIG_KEY } |
|
Same 👍 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This line disallows me to doing this:
This config objects allow me to scope config imports in my components. Wildcard support would allow the developer to specify the environment key name in 2 places (i.e.
.envand in the config objects) instead of 3 (i.e..env,importlist, and in the config objects).Is there a "best practice" reason I'm not aware of for this?
All reactions