Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable usage of envalid in react-native apps #31

Merged
merged 2 commits into from
May 24, 2017

Conversation

barbogast
Copy link
Contributor

PR for #30

With this change I can use envalid in a react-native app if I set dotEnvPath: null and use a custom reporter.

@SimenB
Copy link
Collaborator

SimenB commented May 24, 2017

I think this should be merged. The workaround for fs and dotenv is ugly, but nothing more than that. And if merging this lets @Koblaid avoid forking, I think that's a good thing 😄
We use a custom reporter now anyways (need it to be json to be readable at all in production), so this will in theory boost our startup time as well 😀

Copy link
Collaborator

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the readme with RN instructions?

@barbogast
Copy link
Contributor Author

Right, that was missing.

@af
Copy link
Owner

af commented May 24, 2017

This looks good to me too– I think I had misinterpreted the latest comments on the issue's discussion. The require workarounds are ugly of course but with the comments it's clear what's going on. Thanks for the PR @Koblaid !

@af af merged commit f165d05 into af:master May 24, 2017
@barbogast
Copy link
Contributor Author

Great, thanks!

@SimenB
Copy link
Collaborator

SimenB commented Jun 16, 2017

Should be published, right?

@barbogast
Copy link
Contributor Author

I'm not sure. I just tried to publish my app and when building it with the release configuration I got again errors. Seems like the package loading differs from development builds to release builds. And right now it looks like the preventing the packager from seeing the packages by obfuscating the require calls doesn't work for release builds. :-(

@SimenB
Copy link
Collaborator

SimenB commented Jun 16, 2017

Your changes in this PR has not been published

@barbogast
Copy link
Contributor Author

To verify I just installed envalid from github. When I try to build the app I get the Unable to resolve module fs from ... error.

@barbogast
Copy link
Contributor Author

Right now I cannot think of a way to get it to work. Looks like it'd be the best if we would revert the commit.

I could then fork envalid and replace the dependencies to get it to work.

@af
Copy link
Owner

af commented Jun 16, 2017

@Koblaid I just published v3.1, which does includes your RN changes. Could you give that a try?

@barbogast
Copy link
Contributor Author

@af I just checked v3.1, the error remains the same.

@SimenB
Copy link
Collaborator

SimenB commented Jun 16, 2017

What's the error?

@barbogast
Copy link
Contributor Author

This seems to work:

const x = require
const fs = x('f' + 's')
const dotenv = x('doten' + 'v')

Great, I didn't think that there was a solution. If it's alright with you I would verify that it's really working and prepare a PR.

barbogast added a commit to barbogast/envalid that referenced this pull request Jun 16, 2017
* Enable usage of envalid in react-native apps

* Add chapter for React Native to README
tuannm151 pushed a commit to BSSCommerce/shopify-envalid that referenced this pull request Jul 1, 2024
* Enable usage of envalid in react-native apps

* Add chapter for React Native to README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants