Home / Function/ getConfigHash() — vite Function Reference

getConfigHash() — vite Function Reference

Architecture documentation for the getConfigHash() function in index.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  1dbbbf51_ca8e_49d4_c344_d524f4a56cec["getConfigHash()"]
  2f328851_91ee_fb05_63f0_4f466b9d6250["index.ts"]
  1dbbbf51_ca8e_49d4_c344_d524f4a56cec -->|defined in| 2f328851_91ee_fb05_63f0_4f466b9d6250
  8f966b1b_ebbe_17e4_e14f_b8888709480c["loadCachedDepOptimizationMetadata()"]
  8f966b1b_ebbe_17e4_e14f_b8888709480c -->|calls| 1dbbbf51_ca8e_49d4_c344_d524f4a56cec
  74146d64_5b7b_78cd_e4e7_8edffa229212["getDepHash()"]
  74146d64_5b7b_78cd_e4e7_8edffa229212 -->|calls| 1dbbbf51_ca8e_49d4_c344_d524f4a56cec
  cd876c7b_825e_7e39_9771_1b4f9bfc7754["unique()"]
  1dbbbf51_ca8e_49d4_c344_d524f4a56cec -->|calls| cd876c7b_825e_7e39_9771_1b4f9bfc7754
  9d025481_71dc_8fbb_c07e_b6e74a08a45a["getHash()"]
  1dbbbf51_ca8e_49d4_c344_d524f4a56cec -->|calls| 9d025481_71dc_8fbb_c07e_b6e74a08a45a
  style 1dbbbf51_ca8e_49d4_c344_d524f4a56cec fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/optimizer/index.ts lines 1264–1307

function getConfigHash(environment: Environment): string {
  // Take config into account
  // only a subset of config options that can affect dep optimization
  const { config } = environment
  const { optimizeDeps } = config
  const content = JSON.stringify(
    {
      define: !config.keepProcessEnv
        ? process.env.NODE_ENV || config.mode
        : null,
      root: config.root,
      resolve: config.resolve,
      assetsInclude: config.assetsInclude,
      plugins: config.plugins.map((p) => p.name),
      optimizeDeps: {
        include: optimizeDeps.include
          ? unique(optimizeDeps.include).sort()
          : undefined,
        exclude: optimizeDeps.exclude
          ? unique(optimizeDeps.exclude).sort()
          : undefined,
        rolldownOptions: {
          ...optimizeDeps.rolldownOptions,
          plugins: undefined, // included in optimizeDepsPluginNames
          onLog: undefined,
          onwarn: undefined,
          checks: undefined,
          output: {
            ...optimizeDeps.rolldownOptions?.output,
            plugins: undefined, // included in optimizeDepsPluginNames
          },
        },
      },
      optimizeDepsPluginNames: config.optimizeDepsPluginNames,
    },
    (_, value) => {
      if (typeof value === 'function' || value instanceof RegExp) {
        return value.toString()
      }
      return value
    },
  )
  return getHash(content)
}

Subdomains

Frequently Asked Questions

What does getConfigHash() do?
getConfigHash() is a function in the vite codebase, defined in packages/vite/src/node/optimizer/index.ts.
Where is getConfigHash() defined?
getConfigHash() is defined in packages/vite/src/node/optimizer/index.ts at line 1264.
What does getConfigHash() call?
getConfigHash() calls 2 function(s): getHash, unique.
What calls getConfigHash()?
getConfigHash() is called by 2 function(s): getDepHash, loadCachedDepOptimizationMetadata.

Analyze Your Own Codebase

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

Try Supermodel Free