Home / Function/ runConfigEnvironmentHook() — vite Function Reference

runConfigEnvironmentHook() — vite Function Reference

Architecture documentation for the runConfigEnvironmentHook() function in config.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  dfd74513_1566_83d7_5d5e_d003f8a4d096["runConfigEnvironmentHook()"]
  7da774f9_eca5_d54e_6e01_6bee7d460a2b["config.ts"]
  dfd74513_1566_83d7_5d5e_d003f8a4d096 -->|defined in| 7da774f9_eca5_d54e_6e01_6bee7d460a2b
  58c4a210_68fe_1b4d_ed49_d59203f97ef1["resolveConfig()"]
  58c4a210_68fe_1b4d_ed49_d59203f97ef1 -->|calls| dfd74513_1566_83d7_5d5e_d003f8a4d096
  a188e507_b323_f6f4_af53_0ba33b92284c["getSortedPluginsByHook()"]
  dfd74513_1566_83d7_5d5e_d003f8a4d096 -->|calls| a188e507_b323_f6f4_af53_0ba33b92284c
  58719e23_70bd_67e0_1ed8_f61c19ec725b["getHookHandler()"]
  dfd74513_1566_83d7_5d5e_d003f8a4d096 -->|calls| 58719e23_70bd_67e0_1ed8_f61c19ec725b
  657661b0_3b17_9113_8464_fda5dfafd706["mergeConfig()"]
  dfd74513_1566_83d7_5d5e_d003f8a4d096 -->|calls| 657661b0_3b17_9113_8464_fda5dfafd706
  style dfd74513_1566_83d7_5d5e_d003f8a4d096 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/config.ts lines 2658–2683

async function runConfigEnvironmentHook(
  environments: Record<string, EnvironmentOptions>,
  plugins: Plugin[],
  logger: Logger,
  configEnv: ConfigEnv,
  isSsrTargetWebworkerSet: boolean,
): Promise<void> {
  const context = new BasicMinimalPluginContext<
    Omit<PluginContextMeta, 'watchMode'>
  >(basePluginContextMeta, logger)

  const environmentNames = Object.keys(environments)
  for (const p of getSortedPluginsByHook('configEnvironment', plugins)) {
    const hook = p.configEnvironment
    const handler = getHookHandler(hook)
    for (const name of environmentNames) {
      const res = await handler.call(context, name, environments[name], {
        ...configEnv,
        isSsrTargetWebworker: isSsrTargetWebworkerSet && name === 'ssr',
      })
      if (res) {
        environments[name] = mergeConfig(environments[name], res)
      }
    }
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does runConfigEnvironmentHook() do?
runConfigEnvironmentHook() is a function in the vite codebase, defined in packages/vite/src/node/config.ts.
Where is runConfigEnvironmentHook() defined?
runConfigEnvironmentHook() is defined in packages/vite/src/node/config.ts at line 2658.
What does runConfigEnvironmentHook() call?
runConfigEnvironmentHook() calls 3 function(s): getHookHandler, getSortedPluginsByHook, mergeConfig.
What calls runConfigEnvironmentHook()?
runConfigEnvironmentHook() is called by 1 function(s): resolveConfig.

Analyze Your Own Codebase

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

Try Supermodel Free