publicEnvNames
The names a browser may read among the given names: the prefixed ones and the ones declared in .env.public, sorted.
The names a browser may read among the given names: the prefixed ones and the ones declared in .env.public, sorted.
Import#
ts
import { publicEnvNames } from "@shadow-js/dusk/vite";
Signature#
ts
function publicEnvNames(
names: readonly string[],
declared: readonly string[],
prefixes: readonly string[],
): string[]
Parameters#
| Name | Description |
|---|---|
names |
Every name of the build. |
declared |
Names declared in .env.public. |
prefixes |
The public prefixes. |
Returns#
The public names, sorted and without duplicates.
Examples#
ts
publicEnvNames(["SECRET", "SITE_URL", "DUSK_PUBLIC_KEY"], ["SITE_URL"], ["DUSK_PUBLIC_"]); // ["DUSK_PUBLIC_KEY", "SITE_URL"]