Home / Function/ prepareOutDirPlugin() — vite Function Reference

prepareOutDirPlugin() — vite Function Reference

Architecture documentation for the prepareOutDirPlugin() function in prepareOutDir.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  7e906fcf_994b_bbf0_41a0_ed109ab73503["prepareOutDirPlugin()"]
  4c658b37_85c2_95c4_7b25_9e1e2258e2a4["prepareOutDir.ts"]
  7e906fcf_994b_bbf0_41a0_ed109ab73503 -->|defined in| 4c658b37_85c2_95c4_7b25_9e1e2258e2a4
  8c4db194_5dfd_4391_cc9a_833655009196["resolveBuildPlugins()"]
  8c4db194_5dfd_4391_cc9a_833655009196 -->|calls| 7e906fcf_994b_bbf0_41a0_ed109ab73503
  9b046f45_a2c9_4754_6751_cfb0112161bd["options()"]
  7e906fcf_994b_bbf0_41a0_ed109ab73503 -->|calls| 9b046f45_a2c9_4754_6751_cfb0112161bd
  19d4a1e3_7ff5_51ec_2223_486cb0f131a4["add()"]
  7e906fcf_994b_bbf0_41a0_ed109ab73503 -->|calls| 19d4a1e3_7ff5_51ec_2223_486cb0f131a4
  841e9f5e_2979_644d_f5ee_6e634536197c["getResolvedOutDirs()"]
  7e906fcf_994b_bbf0_41a0_ed109ab73503 -->|calls| 841e9f5e_2979_644d_f5ee_6e634536197c
  dd84c207_766d_3923_500c_1abe3b21a31e["resolveEmptyOutDir()"]
  7e906fcf_994b_bbf0_41a0_ed109ab73503 -->|calls| dd84c207_766d_3923_500c_1abe3b21a31e
  3751e751_4133_da1f_af25_4267e85adc15["prepareOutDir()"]
  7e906fcf_994b_bbf0_41a0_ed109ab73503 -->|calls| 3751e751_4133_da1f_af25_4267e85adc15
  style 7e906fcf_994b_bbf0_41a0_ed109ab73503 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/prepareOutDir.ts lines 10–44

export function prepareOutDirPlugin(): Plugin {
  const rendered = new Set<Environment>()
  return {
    name: 'vite:prepare-out-dir',
    options() {
      rendered.delete(this.environment)
    },
    renderStart: {
      order: 'pre',
      handler() {
        if (rendered.has(this.environment)) {
          return
        }
        rendered.add(this.environment)

        const { config } = this.environment
        if (config.build.write) {
          const { root, build: options } = config
          const resolvedOutDirs = getResolvedOutDirs(
            root,
            options.outDir,
            options.rollupOptions.output,
          )
          const emptyOutDir = resolveEmptyOutDir(
            options.emptyOutDir,
            root,
            resolvedOutDirs,
            this.environment.logger,
          )
          prepareOutDir(resolvedOutDirs, emptyOutDir, this.environment)
        }
      },
    },
  }
}

Domain

Subdomains

Frequently Asked Questions

What does prepareOutDirPlugin() do?
prepareOutDirPlugin() is a function in the vite codebase, defined in packages/vite/src/node/plugins/prepareOutDir.ts.
Where is prepareOutDirPlugin() defined?
prepareOutDirPlugin() is defined in packages/vite/src/node/plugins/prepareOutDir.ts at line 10.
What does prepareOutDirPlugin() call?
prepareOutDirPlugin() calls 5 function(s): add, getResolvedOutDirs, options, prepareOutDir, resolveEmptyOutDir.
What calls prepareOutDirPlugin()?
prepareOutDirPlugin() is called by 1 function(s): resolveBuildPlugins.

Analyze Your Own Codebase

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

Try Supermodel Free