Skip to content

replace dotenv with dotenv-webpack? #6642

Open
@Nickman87

Description

@Nickman87

Is this a bug report?

No

Description

We are using a .env file to make configuration changes easy between our different environments and it works great.
However, the way that dotenv works it not particularly interesting as it:

  1. bloats the code (even minified)
  2. exposes all environment variables right next to each other (the values will become public anyway, but you don't need them to be right next to each other)

In our codebase, we have a couple of variables and this block is inserted six times into our code:
Image of Yaktocat

In a project without create-react-app I've been using dotenv-webpack with great success. It effectively replaces your call to an environment variable with the value itself, minimizing code bloat.

I believe this would be a small change in the code, but I was wondering if there are reasons not to do this? If there is no reason not to switch it, I would like to work on a PR.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions