2.1.0 • Published 4 years ago

@marvman/preact-cli-plugin-env-vars v2.1.0

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

preact-cli-plugin-env-vars

Consume variables in your environment with the Preact CLI.

NPM version Node.js CI

Installation

$ yarn add @marvman/preact-cli-plugin-env-vars

And include in your project by creating a preact.config.js:

import envVars from "@marvman/preact-cli-plugin-env-vars";

export default function (config, env, helpers) {
	envVars(config, env, helpers);
}

Usage

The plugin allows to use any environment variables prefixed with PREACT_APP_ to be used within your script:

console.log(process.env.PREACT_APP_SECRET_CODE);

The environment variables are embedded during the build time.

Adding development Environment Variables in .env

To define permanent environment variables, create a file called .env in the root of your project:

PREACT_APP_SECRET_CODE=abcdef

These variables will act as the defaults if the machine does not explicitly set them. Please refer to the dotenv documentation for more details.

License

MIT © Marvin Schopf, Robin van der Vleuten

2.1.0

4 years ago

2.0.0

4 years ago

1.3.0

4 years ago

1.2.2

4 years ago