Lazy Universal DotEnv
Lazy Universal DotEnv - A Robust Environment Configuration for Universal Applications.
- Supports loading
.envfiles with overriding between different
- Supports variable expansion between different settings.
- Allows local overrides using files which use a ".local" postfix.
It is important to remember that all environment variables are always stored as strings. Even numbers and booleans. The casting to other types must therefore take place in the application code. See also: https://github.com/motdotla/dotenv/issues/51
NODE_ENV: Typically either
Files are being loaded in this order. Values which are already set are never overwritten. Command line environment settings e.g. via cross-env always win.
local files without
NODE_ENV are not respected when running in
;const environment = ;const raw stringified webpack = environment;
After this you can access all environment settings you have defined in one of your
A .env file:
;// ...plugins:webpack// ...
Code being bundled by webpack:
console; // -> "awesome"
- raw: Just a plain JS object containing all app settings
- stringified: Plain object but with JSON stringified values
- webpack: For usage with Webpacks Define Plugin
Sebastian Software GmbH