webpack-dotenv-plugin icon indicating copy to clipboard operation
webpack-dotenv-plugin copied to clipboard

Feature request: use dotenv-extended instead

Open vlindhol opened this issue 8 years ago • 1 comments

dotenv-safe is great, but dotenv-extended has the same functionality PLUS the ability to set default values for env variables. This makes it easy to check in sensible defaults into git, and if you need to input sensitive values or just a different configuration, you can use .env as normal. I use it in almost all my projects, very handy.

vlindhol avatar Jul 28 '17 11:07 vlindhol

@vlindhol I forked this project and modified it for dotenv-extended: https://github.com/Alex-Krautmann/webpack-dotenv-extended-plugin. It worked out well for me in a universal react application. I was able to define default env vars for development and production build modes, then have deployment-environment specific env vars as the main env:

new DotEnvExtendedPlugin({
    errorOnMissing: true,
    errorOnExtra: true,
    schema: './env/.env.schema',
    defaults: './env/.env.defaults.development',
    path: `./env/deploymentEnv/.env.${process.env.DEPLOYMENT_ENV || 'dev'}`,
}),

@nwinch I am happy to submit a PR if this is something you want.

alexkrautmann avatar Oct 25 '17 20:10 alexkrautmann