1.0.7 • Published 2 years ago

rollup-plugin-process-env v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

NPM downloads changelog license

rollup-plugin-process-env

šŸ£ A Rollup plugin which injects process.env variables into build.

stars watchers

Install

npm i rollup-plugin-process-env

Usage

Use prefix to inject environments from current process.env which starts with the prefix.

import env from 'rollup-plugin-process-env'

export default {
  plugins: [
    env('MY_PREFIX_'),
  ],
}

Use dotenv and dotenv-expand to get environments from .env and outer environments

import env from 'rollup-plugin-process-env'

require('dotenv-expand').expand(require('dotenv').config())

export default {
  plugins: [
    env('MY_PREFIX_'),
  ],
}

Filter environments by name

import env from 'rollup-plugin-process-env'

const envs = ['MY_ENV', 'ANOTHER_MY_NAME']

export default {
  plugins: [
    env(name => envs.includes(name)),
  ],
}

Provide an object to include it as process.env

import env from 'rollup-plugin-process-env'

export default {
  plugins: [
    env({ MY_ENV: 'true' }),
  ],
}

Issues

If you find a bug or have a suggestion, please file an issue on GitHub.

issues

1.0.7

2 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.0

3 years ago