Socket
Socket
Sign inDemoInstall

react-native-dotenv

Package Overview
Dependencies
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-dotenv - npm Package Compare versions

Comparing version 2.5.0 to 2.5.1

2

index.js

@@ -35,3 +35,3 @@ const {readFileSync} = require('fs')

const babelMode = process.env.APP_ENV || process.env.BABEL_ENV || process.env.NODE_ENV || 'development'
const babelMode = process.env.APP_ENV || (process.env.BABEL_ENV && process.env.BABEL_ENV !== 'undefined' && process.env.BABEL_ENV) || process.env.NODE_ENV || 'development'
if (this.opts.safe) {

@@ -38,0 +38,0 @@ const parsed = parseDotenvFile(this.opts.path, this.opts.verbose)

{
"name": "react-native-dotenv",
"version": "2.5.0",
"version": "2.5.1",
"description": "Load environment variables using import statements.",

@@ -5,0 +5,0 @@ "repository": "github:goatandsheep/react-native-dotenv",

@@ -168,5 +168,25 @@ # react-native-dotenv [![CircleCI](https://circleci.com/gh/goatandsheep/react-native-dotenv.svg?style=svg)](https://circleci.com/gh/goatandsheep/react-native-dotenv)

## TypeScript
### Reference Material
- Create a `types` folder in your project
- Inside that folder, create a `*.d.ts`file, say, `env.d.ts`
- in that file, declare a module as the following format:
```ts
declare module '@env' {
export const API_BASE: string;
}
```
Add all of your .env variables inside this module.
- Finally, add this folder into the `typeRoots` field in your `tsconfig.json` file:
```json
{
...
"typeRoots": ["./src/types"],
...
}
```
## Reference Material
* [babel environments](https://babeljs.io/docs/en/6.26.3/babelrc#env-option)

@@ -187,2 +207,16 @@ * [dotenv documentation](https://www.npmjs.com/package/dotenv)

or
`yarn start --reset-cache`
or
`expo r -c`
Maybe a solution for updating package.json scripts:
> "cc": "rimraf node_modules/.cache/babel-loader/*,",
> "android": "npm run cc && react-native run-android",
> "ios": "npm run cc && react-native run-ios",
Or you can override the default `cacheIdentifier` to include some of your environment variables.

@@ -189,0 +223,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc