# define-env-plugin

> Enable client code to get node variables

Latest version **0.1.5** (published 2019-12-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install define-env-plugin
pnpm add define-env-plugin
yarn add define-env-plugin
bun add define-env-plugin
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2019-12-12 |
| First published | 2019-12-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dylan |
| Maintainers | bearcookie |
| Keywords | webpack, plugin, webpack-plugin, define-webpack-plugin, json, javascript |

## Links

- npm: https://www.npmjs.com/package/define-env-plugin
- Repository: https://github.com/dylan-7/define-env-plugin
- Homepage: https://github.com/dylan-7/define-env-plugin/#readme
- Issues: https://github.com/dylan-7/define-env-plugin/issues
- npm.io page: https://npm.io/package/define-env-plugin

## 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

- 0.1.5 (latest) — 2019-12-12
- 0.1.4 — 2019-12-10
- 0.1.3 — 2019-12-01
- 0.1.2 — 2019-12-01
- 0.1.1 — 2019-12-01
- 0.1.0 — 2019-12-01

## README

# define-env-plugin

Enable client code to get node variables

## Installation
```
yarn add define-env-plugin -D
```

## Usage
```js
// webpack.config.js

const DefineEnvPlugin = require('define-env-plugin');

module.exports = {
  plugins: [
    // 
    new DefineEnvPlugin(['APP_VERSION', 'AUTHOR'])
  ]
};
```

In client code use it
```js
// main.js
// process.env can get the fields in the scripts of package.js

console.log(process.env);
```


## Options

NODE_ENV and SERVICE_URL are built in by default, You can pass in other fields

```js
  DefineEnvPlugin(['APP_VERSION', 'AUTHOR'])
```

Available options are:

NODE_ENV (string): environment for browser.

SERVICE_URL (string): http url for api.

SOCKET_URL (string): websocket url for api.

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