Home / Function/ loadTerserPath() — vite Function Reference

loadTerserPath() — vite Function Reference

Architecture documentation for the loadTerserPath() function in terser.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  39ac1178_9b7e_dd67_f753_f2fb1b78e04a["loadTerserPath()"]
  be81372e_415b_426f_d3c1_132b2d458ce6["terser.ts"]
  39ac1178_9b7e_dd67_f753_f2fb1b78e04a -->|defined in| be81372e_415b_426f_d3c1_132b2d458ce6
  087bc308_b1da_3dca_40fd_0cf762502823["terserPlugin()"]
  087bc308_b1da_3dca_40fd_0cf762502823 -->|calls| 39ac1178_9b7e_dd67_f753_f2fb1b78e04a
  363641b4_de9b_dbe1_f421_1fd46e488386["nodeResolveWithVite()"]
  39ac1178_9b7e_dd67_f753_f2fb1b78e04a -->|calls| 363641b4_de9b_dbe1_f421_1fd46e488386
  style 39ac1178_9b7e_dd67_f753_f2fb1b78e04a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/terser.ts lines 23–36

function loadTerserPath(root: string) {
  if (terserPath) return terserPath

  // Try resolve from project root first, then the current vite installation path
  const resolved =
    nodeResolveWithVite('terser', undefined, { root }) ??
    nodeResolveWithVite('terser', _dirname, { root })
  if (resolved) return (terserPath = resolved)

  // Error if we can't find the package
  throw new Error(
    'terser not found. Since Vite v3, terser has become an optional dependency. You need to install it.',
  )
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does loadTerserPath() do?
loadTerserPath() is a function in the vite codebase, defined in packages/vite/src/node/plugins/terser.ts.
Where is loadTerserPath() defined?
loadTerserPath() is defined in packages/vite/src/node/plugins/terser.ts at line 23.
What does loadTerserPath() call?
loadTerserPath() calls 1 function(s): nodeResolveWithVite.
What calls loadTerserPath()?
loadTerserPath() is called by 1 function(s): terserPlugin.

Analyze Your Own Codebase

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

Try Supermodel Free