Home / Function/ enhanceRollupError() — vite Function Reference

enhanceRollupError() — vite Function Reference

Architecture documentation for the enhanceRollupError() function in build.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  365dd1a8_292f_ae21_8f83_1ecfde441d37["enhanceRollupError()"]
  45981d85_cbdd_e969_8c88_c17072ea0eda["build.ts"]
  365dd1a8_292f_ae21_8f83_1ecfde441d37 -->|defined in| 45981d85_cbdd_e969_8c88_c17072ea0eda
  94ad7f99_b02e_152e_c5a9_749d6de8d3c0["buildEnvironment()"]
  94ad7f99_b02e_152e_c5a9_749d6de8d3c0 -->|calls| 365dd1a8_292f_ae21_8f83_1ecfde441d37
  87db59b7_cd95_f474_5a57_d5262adfb451["extractStack()"]
  365dd1a8_292f_ae21_8f83_1ecfde441d37 -->|calls| 87db59b7_cd95_f474_5a57_d5262adfb451
  9d0f27bb_ba9b_7f13_2669_3a94dfacbd10["normalizeCodeFrame()"]
  365dd1a8_292f_ae21_8f83_1ecfde441d37 -->|calls| 9d0f27bb_ba9b_7f13_2669_3a94dfacbd10
  style 365dd1a8_292f_ae21_8f83_1ecfde441d37 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/build.ts lines 887–914

export function enhanceRollupError(e: RollupError): void {
  const stackOnly = extractStack(e)

  let msg = colors.red((e.plugin ? `[${e.plugin}] ` : '') + e.message)
  if (e.loc && e.loc.file && e.loc.file !== e.id) {
    msg += `\nfile: ${colors.cyan(
      `${e.loc.file}:${e.loc.line}:${e.loc.column}` +
        (e.id ? ` (${e.id})` : ''),
    )}`
  } else if (e.id) {
    msg += `\nfile: ${colors.cyan(
      e.id + (e.loc ? `:${e.loc.line}:${e.loc.column}` : ''),
    )}`
  }
  if (e.frame) {
    msg += `\n` + colors.yellow(normalizeCodeFrame(e.frame))
  }

  e.message = msg

  // We are rebuilding the stack trace to include the more detailed message at the top.
  // Previously this code was relying on mutating e.message changing the generated stack
  // when it was accessed, but we don't have any guarantees that the error we are working
  // with hasn't already had its stack accessed before we get here.
  if (stackOnly !== undefined) {
    e.stack = `${e.message}\n${stackOnly}`
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does enhanceRollupError() do?
enhanceRollupError() is a function in the vite codebase, defined in packages/vite/src/node/build.ts.
Where is enhanceRollupError() defined?
enhanceRollupError() is defined in packages/vite/src/node/build.ts at line 887.
What does enhanceRollupError() call?
enhanceRollupError() calls 2 function(s): extractStack, normalizeCodeFrame.
What calls enhanceRollupError()?
enhanceRollupError() is called by 1 function(s): buildEnvironment.

Analyze Your Own Codebase

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

Try Supermodel Free