[]previous and next page

checkEnvFiles

Refuses a name that is declared in a public file and also in a server file: its value would be public or not depending on which file wins, so the build fails instead.

Refuses a name that is declared in a public file and also in a server file: its value would be public or not depending on which file wins, so the build fails instead. A prefixed name is public whatever file declares it, so it never conflicts.

Import#

ts
import { checkEnvFiles } from "@shadow-js/dusk/vite";

Signature#

ts
function checkEnvFiles(files: EnvFiles, prefixes: readonly string[]): void

Parameters#

Name Description
files The env files, from readEnvFiles.
prefixes The public prefixes.

Throws#

  • TypeError [ENV_PUBLIC_CONFLICT] naming the variable and its files, never a value.

Examples#

ts
checkEnvFiles(readEnvFiles("development", "/app"), ["DUSK_PUBLIC_"]); // throws when a name is in .env.public and in .env