Function: importMetaEnv()
Documentation / @wtf/platform-browser / env / importMetaEnv
function importMetaEnv(env): Env;Defined in: packages/platform-browser/src/env.ts:121
The variables of import.meta.env, as the caller hands it over, each of a string value: a copy,
frozen.
import { prefixed } from '@wtf/platform/env'import { importMetaEnv } from '@wtf/platform-browser/env'
const env = prefixed(importMetaEnv(import.meta.env), 'VITE_', { strip: true })Vite puts in it, of the environment it builds in and its .env files, only the variables whose
names start with its envPrefix, VITE_ by default, so no other reaches the page; and MODE
and BASE_URL, strings, which it keeps. DEV, PROD and SSR are booleans, and left out:
read them of import.meta.env itself. It is the caller’s import.meta.env, which Vite writes
into the code of the caller’s module as it builds it, and not this package’s.
Parameters
| Parameter | Type |
|---|---|
env | Readonly<Record<string, unknown>> |
