Home / Function/ enableSourceMapSupport() — vite Function Reference

enableSourceMapSupport() — vite Function Reference

Architecture documentation for the enableSourceMapSupport() function in index.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  7782529b_f75d_f900_da5a_2ee3398e1468["enableSourceMapSupport()"]
  bb968c6f_5ad4_dc29_bac1_0b2ebcedc26d["index.ts"]
  7782529b_f75d_f900_da5a_2ee3398e1468 -->|defined in| bb968c6f_5ad4_dc29_bac1_0b2ebcedc26d
  8db7bac6_7d0a_15b2_5870_1fd0e71b9cf5["constructor()"]
  8db7bac6_7d0a_15b2_5870_1fd0e71b9cf5 -->|calls| 7782529b_f75d_f900_da5a_2ee3398e1468
  dcb2b4e7_ff7f_675e_b5df_3152ca6e9684["interceptStackTrace()"]
  7782529b_f75d_f900_da5a_2ee3398e1468 -->|calls| dcb2b4e7_ff7f_675e_b5df_3152ca6e9684
  style 7782529b_f75d_f900_da5a_2ee3398e1468 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/module-runner/sourcemap/index.ts lines 4–28

export function enableSourceMapSupport(runner: ModuleRunner): () => void {
  if (runner.options.sourcemapInterceptor === 'node') {
    if (typeof process === 'undefined') {
      throw new TypeError(
        `Cannot use "sourcemapInterceptor: 'node'" because global "process" variable is not available.`,
      )
    }
    /* eslint-disable n/no-unsupported-features/node-builtins -- process.setSourceMapsEnabled and process.sourceMapsEnabled */
    if (typeof process.setSourceMapsEnabled !== 'function') {
      throw new TypeError(
        `Cannot use "sourcemapInterceptor: 'node'" because "process.setSourceMapsEnabled" function is not available. Please use Node >= 16.6.0.`,
      )
    }
    const isEnabledAlready = process.sourceMapsEnabled ?? false
    process.setSourceMapsEnabled(true)
    return () => !isEnabledAlready && process.setSourceMapsEnabled(false)
    /* eslint-enable n/no-unsupported-features/node-builtins */
  }
  return interceptStackTrace(
    runner,
    typeof runner.options.sourcemapInterceptor === 'object'
      ? runner.options.sourcemapInterceptor
      : undefined,
  )
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does enableSourceMapSupport() do?
enableSourceMapSupport() is a function in the vite codebase, defined in packages/vite/src/module-runner/sourcemap/index.ts.
Where is enableSourceMapSupport() defined?
enableSourceMapSupport() is defined in packages/vite/src/module-runner/sourcemap/index.ts at line 4.
What does enableSourceMapSupport() call?
enableSourceMapSupport() calls 1 function(s): interceptStackTrace.
What calls enableSourceMapSupport()?
enableSourceMapSupport() is called by 1 function(s): constructor.

Analyze Your Own Codebase

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

Try Supermodel Free