zetachang / react-native-dotenv

A Babel preset let you import application configs from .env file (zero runtime dependency)
MIT License
915 stars 68 forks source link

Updates for RN 0.56.0 #42

Closed adamivancza closed 6 years ago

adamivancza commented 6 years ago

I got two errors when I tried to run my project with RN 0.56.0-rc.2:

npedrini commented 6 years ago

Thanks @adamivancza! Would be great if we could get this rolled into master as I'm getting the same errors.

adamivancza commented 6 years ago

while we're waiting for the merge you can reference my fork directly: "react-native-dotenv": "https://github.com/adamivancza/react-native-dotenv"

ashishmusale commented 6 years ago

@adamivancza I tried your branch, but I am still getting the same error.

adamivancza commented 6 years ago

@ashishmusale did you run npm install then restart your packager?

ashishmusale commented 6 years ago

Yes, I did. I deleted node_modules and ran npm install

wkoutre commented 6 years ago

Simple and excellent @adamivancza. Appreciate it!

mikefogg commented 6 years ago

Think we can get this one merged into master? Great fix @adamivancza !

anshul-kai commented 6 years ago

Don't forget to update your .babelrc file @ashishmusale

sibelius commented 6 years ago

@zetachang can we get this in?

zetachang commented 6 years ago

Hey guys, thank you for working on this, I am looking into it and see if I could merge this and release a new version this weekend. 💪

wkoutre commented 6 years ago

Thanks @zetachang !

ou2s commented 6 years ago

like @ashishmusale I still have the issues mentioned above.

wkoutre commented 6 years ago

If you're on react-native@0.56.0, things to consider:

  1. Run cat yarn.lock | grep react-native-dotenv in your Terminal to see what's actually being resolved in your project. The result should look like:
react-native-dotenv@^0.2.0:
  resolved "https://registry.yarnpkg.com/react-native-dotenv/-/react-native-dotenv-0.2.0.tgz#311551cb6a35a3dcfede648bded55c0e3ece579d"
  1. If you don't see this, I would be sure you have "react-native-dotenv": "^0.2.0", in your package.json, then, in Terminal, run:
watchman watch-del-all
killall -9 node
rm yarn.lock
yarn
  1. Now, you should get the output above from your yarn.lock file in terms of what react-native-dotenv resolves to.
  2. No need to rebuild, since this is just a JS package.
  3. Check that your .babelrc file's "presets" line looks similar to:
    "presets": ["react-native", "module:react-native-dotenv"],
  4. Restart your packager and run on your simulator/device!