Home / Function/ resolveEnvPrefix() — vite Function Reference

resolveEnvPrefix() — vite Function Reference

Architecture documentation for the resolveEnvPrefix() function in env.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  3683cd63_6033_ad37_3392_8ecf602fefea["resolveEnvPrefix()"]
  7fa76fc1_cb1b_cf98_0900_1217276f6616["env.ts"]
  3683cd63_6033_ad37_3392_8ecf602fefea -->|defined in| 7fa76fc1_cb1b_cf98_0900_1217276f6616
  58c4a210_68fe_1b4d_ed49_d59203f97ef1["resolveConfig()"]
  58c4a210_68fe_1b4d_ed49_d59203f97ef1 -->|calls| 3683cd63_6033_ad37_3392_8ecf602fefea
  74ff6a26_1c5b_a015_895e_a968330cb049["htmlEnvHook()"]
  74ff6a26_1c5b_a015_895e_a968330cb049 -->|calls| 3683cd63_6033_ad37_3392_8ecf602fefea
  19ce2051_6a74_4b8b_104d_ec006cd7075f["arraify()"]
  3683cd63_6033_ad37_3392_8ecf602fefea -->|calls| 19ce2051_6a74_4b8b_104d_ec006cd7075f
  style 3683cd63_6033_ad37_3392_8ecf602fefea fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/env.ts lines 97–115

export function resolveEnvPrefix({
  envPrefix = 'VITE_',
}: UserConfig): string[] {
  envPrefix = arraify(envPrefix)
  if (envPrefix.includes('')) {
    throw new Error(
      `envPrefix option contains value '', which could lead unexpected exposure of sensitive information.`,
    )
  }
  if (envPrefix.some((prefix) => /\s/.test(prefix))) {
    // eslint-disable-next-line no-console
    console.warn(
      colors.yellow(
        `[vite] Warning: envPrefix option contains values with whitespace, which does not work in practice.`,
      ),
    )
  }
  return envPrefix
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does resolveEnvPrefix() do?
resolveEnvPrefix() is a function in the vite codebase, defined in packages/vite/src/node/env.ts.
Where is resolveEnvPrefix() defined?
resolveEnvPrefix() is defined in packages/vite/src/node/env.ts at line 97.
What does resolveEnvPrefix() call?
resolveEnvPrefix() calls 1 function(s): arraify.
What calls resolveEnvPrefix()?
resolveEnvPrefix() is called by 2 function(s): htmlEnvHook, resolveConfig.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free