# babel-plugin-env-json

> Load environment variables from json file using import statement

Latest version **1.0.0** (published 2018-02-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-env-json
pnpm add babel-plugin-env-json
yarn add babel-plugin-env-json
bun add babel-plugin-env-json
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-02-17 |
| First published | 2018-02-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 36.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Fareed Alnamrouti |
| Maintainers | digital.flowers |
| Keywords | env, json, babel-plugin, config |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-env-json
- Repository: https://github.com/digital-flowers/babel-plugin-env-json
- Homepage: https://github.com/digital-flowers/babel-plugin-env-json#readme
- Issues: https://github.com/digital-flowers/babel-plugin-env-json/issues
- npm.io page: https://npm.io/package/babel-plugin-env-json

## Dependencies (1)

- [deepmerge](https://npm.io/package/deepmerge.md) ^2.0.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-02-17

## README

# babel-plugin-env-json

Loads environment variables from a json file through `import` statement.

## Installation

```sh
$ npm install babel-plugin-env-json
```

## Usage

**.babelrc**

```json
{
  "plugins": [["babel-plugin-env-json", {
      "replacedModuleName": "babel-env-json"
   }]]
}
```

**env/default.json**

```json
{
  "db":{
    "host":"localhost",
    "username":"root",
    "password":"LOL"
  },
  "api":{
    "endpoint":"https://google.com/api"
  }
}
```

In **your-code.js**

```js
import {db, api} from "babel-env-json"
connection.connect(db);
console.log(api.endpoint); // "https://google.com/api"
```

---
_Source: https://npm.io/package/babel-plugin-env-json · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
