MCPcopy
hub / github.com/vitejs/vite / getEnvFilesForMode

Function getEnvFilesForMode

packages/vite/src/node/env.ts:13–27  ·  view source on GitHub ↗
(
  mode: string,
  envDir: string | false,
)

Source from the content-addressed store, hash-verified

11const debug = createDebugger('vite:env')
12
13export function getEnvFilesForMode(
14 mode: string,
15 envDir: string | false,
16): string[] {
17 if (envDir !== false) {
18 return [
19 /** default file */ `.env`,
20 /** local file */ `.env.local`,
21 /** mode file */ `.env.${mode}`,
22 /** mode local file */ `.env.${mode}.local`,
23 ].map((file) => normalizePath(path.join(envDir, file)))
24 }
25
26 return []
27}
28
29/**
30 * Load `.env` files within the `envDir` and merge them with the matching

Callers 3

_createServerFunction · 0.90
handleHMRUpdateFunction · 0.90
loadEnvFunction · 0.85

Calls 1

normalizePathFunction · 0.90

Tested by

no test coverage detected