Home / Function/ resolveEmptyOutDir() — vite Function Reference

resolveEmptyOutDir() — vite Function Reference

Architecture documentation for the resolveEmptyOutDir() function in watch.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  dd84c207_766d_3923_500c_1abe3b21a31e["resolveEmptyOutDir()"]
  b4c4dcfb_d52b_008a_a6fc_ed4f2bf1f714["watch.ts"]
  dd84c207_766d_3923_500c_1abe3b21a31e -->|defined in| b4c4dcfb_d52b_008a_a6fc_ed4f2bf1f714
  94ad7f99_b02e_152e_c5a9_749d6de8d3c0["buildEnvironment()"]
  94ad7f99_b02e_152e_c5a9_749d6de8d3c0 -->|calls| dd84c207_766d_3923_500c_1abe3b21a31e
  7e906fcf_994b_bbf0_41a0_ed109ab73503["prepareOutDirPlugin()"]
  7e906fcf_994b_bbf0_41a0_ed109ab73503 -->|calls| dd84c207_766d_3923_500c_1abe3b21a31e
  24ecf2a1_3c09_d451_76f3_9485b4e993f8["_createServer()"]
  24ecf2a1_3c09_d451_76f3_9485b4e993f8 -->|calls| dd84c207_766d_3923_500c_1abe3b21a31e
  a4adb1a7_cf54_091f_eb63_8217e684a8e1["normalizePath()"]
  dd84c207_766d_3923_500c_1abe3b21a31e -->|calls| a4adb1a7_cf54_091f_eb63_8217e684a8e1
  1a3bec7b_1a11_316f_5831_a0535b829bbf["withTrailingSlash()"]
  dd84c207_766d_3923_500c_1abe3b21a31e -->|calls| 1a3bec7b_1a11_316f_5831_a0535b829bbf
  style dd84c207_766d_3923_500c_1abe3b21a31e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/watch.ts lines 26–49

export function resolveEmptyOutDir(
  emptyOutDir: boolean | null,
  root: string,
  outDirs: Set<string>,
  logger?: Logger,
): boolean {
  if (emptyOutDir != null) return emptyOutDir

  for (const outDir of outDirs) {
    if (!normalizePath(outDir).startsWith(withTrailingSlash(root))) {
      // warn if outDir is outside of root
      logger?.warn(
        colors.yellow(
          `\n${colors.bold(`(!)`)} outDir ${colors.white(
            colors.dim(outDir),
          )} is not inside project root and will not be emptied.\n` +
            `Use --emptyOutDir to override.\n`,
        ),
      )
      return false
    }
  }
  return true
}

Domain

Subdomains

Frequently Asked Questions

What does resolveEmptyOutDir() do?
resolveEmptyOutDir() is a function in the vite codebase, defined in packages/vite/src/node/watch.ts.
Where is resolveEmptyOutDir() defined?
resolveEmptyOutDir() is defined in packages/vite/src/node/watch.ts at line 26.
What does resolveEmptyOutDir() call?
resolveEmptyOutDir() calls 2 function(s): normalizePath, withTrailingSlash.
What calls resolveEmptyOutDir()?
resolveEmptyOutDir() is called by 3 function(s): _createServer, buildEnvironment, prepareOutDirPlugin.

Analyze Your Own Codebase

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

Try Supermodel Free