Home / Function/ prepareStackTrace() — vite Function Reference

prepareStackTrace() — vite Function Reference

Architecture documentation for the prepareStackTrace() function in interceptor.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  da4d3379_e9f7_bafd_68cb_bfdc14e6f52a["prepareStackTrace()"]
  95cae2f2_ad8c_91c1_5a74_93d939dbc47b["interceptor.ts"]
  da4d3379_e9f7_bafd_68cb_bfdc14e6f52a -->|defined in| 95cae2f2_ad8c_91c1_5a74_93d939dbc47b
  b30dd025_db49_148b_f0bc_60f33ba97a2d["wrapCallSite()"]
  da4d3379_e9f7_bafd_68cb_bfdc14e6f52a -->|calls| b30dd025_db49_148b_f0bc_60f33ba97a2d
  style da4d3379_e9f7_bafd_68cb_bfdc14e6f52a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/module-runner/sourcemap/interceptor.ts lines 411–424

function prepareStackTrace(error: Error, stack: CallSite[]) {
  const name = error.name || 'Error'
  const message = error.message || ''
  const errorString = `${name}: ${message}`

  const state = { nextPosition: null, curPosition: null }
  const processedStack = []
  for (let i = stack.length - 1; i >= 0; i--) {
    processedStack.push(`\n    at ${wrapCallSite(stack[i], state)}`)
    state.nextPosition = state.curPosition
  }
  state.curPosition = state.nextPosition = null
  return errorString + processedStack.reverse().join('')
}

Domain

Subdomains

Frequently Asked Questions

What does prepareStackTrace() do?
prepareStackTrace() is a function in the vite codebase, defined in packages/vite/src/module-runner/sourcemap/interceptor.ts.
Where is prepareStackTrace() defined?
prepareStackTrace() is defined in packages/vite/src/module-runner/sourcemap/interceptor.ts at line 411.
What does prepareStackTrace() call?
prepareStackTrace() calls 1 function(s): wrapCallSite.

Analyze Your Own Codebase

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

Try Supermodel Free