Home / Function/ getCodeWithSourcemap() — vite Function Reference

getCodeWithSourcemap() — vite Function Reference

Architecture documentation for the getCodeWithSourcemap() function in sourcemap.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  0d5a3ce6_a346_6e0c_cb12_77d5afc6444c["getCodeWithSourcemap()"]
  18244f7c_8357_ba88_c896_32c6447f1faf["sourcemap.ts"]
  0d5a3ce6_a346_6e0c_cb12_77d5afc6444c -->|defined in| 18244f7c_8357_ba88_c896_32c6447f1faf
  cd131d16_e223_ab79_1b7c_8ea449ae51a2["cssPostPlugin()"]
  cd131d16_e223_ab79_1b7c_8ea449ae51a2 -->|calls| 0d5a3ce6_a346_6e0c_cb12_77d5afc6444c
  c7929a5b_9791_180a_9c0b_4f479fb4cf3f["devHtmlHook()"]
  c7929a5b_9791_180a_9c0b_4f479fb4cf3f -->|calls| 0d5a3ce6_a346_6e0c_cb12_77d5afc6444c
  7c73fde5_2ada_95e2_0b3f_1ad78222da67["send()"]
  7c73fde5_2ada_95e2_0b3f_1ad78222da67 -->|calls| 0d5a3ce6_a346_6e0c_cb12_77d5afc6444c
  0857a370_8db0_3f2b_ac58_b48c57bd6a12["genSourceMapUrl()"]
  0d5a3ce6_a346_6e0c_cb12_77d5afc6444c -->|calls| 0857a370_8db0_3f2b_ac58_b48c57bd6a12
  style 0d5a3ce6_a346_6e0c_cb12_77d5afc6444c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/server/sourcemap.ts lines 93–109

export function getCodeWithSourcemap(
  type: 'js' | 'css',
  code: string,
  map: SourceMap,
): string {
  if (debug) {
    code += `\n/*${JSON.stringify(map, null, 2).replace(/\*\//g, '*\\/')}*/\n`
  }

  if (type === 'js') {
    code += `\n//# sourceMappingURL=${genSourceMapUrl(map)}`
  } else if (type === 'css') {
    code += `\n/*# sourceMappingURL=${genSourceMapUrl(map)} */`
  }

  return code
}

Domain

Subdomains

Frequently Asked Questions

What does getCodeWithSourcemap() do?
getCodeWithSourcemap() is a function in the vite codebase, defined in packages/vite/src/node/server/sourcemap.ts.
Where is getCodeWithSourcemap() defined?
getCodeWithSourcemap() is defined in packages/vite/src/node/server/sourcemap.ts at line 93.
What does getCodeWithSourcemap() call?
getCodeWithSourcemap() calls 1 function(s): genSourceMapUrl.
What calls getCodeWithSourcemap()?
getCodeWithSourcemap() is called by 3 function(s): cssPostPlugin, devHtmlHook, send.

Analyze Your Own Codebase

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

Try Supermodel Free