Home / Class/ BuildEnvironment Class — vite Architecture

BuildEnvironment Class — vite Architecture

Architecture documentation for the BuildEnvironment class in build.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  8a1be4dc_fab4_3c44_dfe9_6115f2fdf4e8["BuildEnvironment"]
  45981d85_cbdd_e969_8c88_c17072ea0eda["build.ts"]
  8a1be4dc_fab4_3c44_dfe9_6115f2fdf4e8 -->|defined in| 45981d85_cbdd_e969_8c88_c17072ea0eda
  cabe2806_669c_8157_2f2b_3ede5eddbb5a["constructor()"]
  8a1be4dc_fab4_3c44_dfe9_6115f2fdf4e8 -->|method| cabe2806_669c_8157_2f2b_3ede5eddbb5a
  2b805bd3_afe5_06fa_d723_ae5cd9934c6e["init()"]
  8a1be4dc_fab4_3c44_dfe9_6115f2fdf4e8 -->|method| 2b805bd3_afe5_06fa_d723_ae5cd9934c6e

Relationship Graph

Source Code

packages/vite/src/node/build.ts lines 1685–1715

export class BuildEnvironment extends BaseEnvironment {
  mode = 'build' as const

  isBuilt = false
  constructor(
    name: string,
    config: ResolvedConfig,
    setup?: {
      options?: EnvironmentOptions
    },
  ) {
    let options = config.environments[name]
    if (!options) {
      throw new Error(`Environment "${name}" is not defined in the config.`)
    }
    if (setup?.options) {
      options = mergeConfig(
        options,
        setup.options,
      ) as ResolvedEnvironmentOptions
    }
    super(name, config, options)
  }

  async init(): Promise<void> {
    if (this._initiated) {
      return
    }
    this._initiated = true
  }
}

Domain

Frequently Asked Questions

What is the BuildEnvironment class?
BuildEnvironment is a class in the vite codebase, defined in packages/vite/src/node/build.ts.
Where is BuildEnvironment defined?
BuildEnvironment is defined in packages/vite/src/node/build.ts at line 1685.

Analyze Your Own Codebase

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

Try Supermodel Free