0.0.7 • Published 1 year ago

static-build-env v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Dynamic environment variables in static builds

This is a companion package to the https://github.com/anton-fomin/inject-env tool. Which allows to inject enviroment variables as JSON to static builds.

It simplifies a bit usage of the injected environment variables.

Installation

npm i static-build-env

Usage

If the inject-env was used as in documentation examples then the usage would be:

Create a settings.ts file

import { defineEnv } from 'static-build-env'
const env = defineEnv() as Record<string, unknown> // defineEnv return type is unknown, because only you know what you put there

// Export some constant
export const API_URL: string = env.API_URL || import.meta.env.API_URL || '/graphql'

Then just import these constants in your code.

0.0.7

1 year ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago