Home / Function/ prependModenChunkLegacyGuardPlugin() — vite Function Reference

prependModenChunkLegacyGuardPlugin() — vite Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a7649197_476f_f6d6_789f_bc82f5fd3ea4["prependModenChunkLegacyGuardPlugin()"]
  9776ecb6_00c0_b3b9_b3f7_177fedabeacc["index.ts"]
  a7649197_476f_f6d6_789f_bc82f5fd3ea4 -->|defined in| 9776ecb6_00c0_b3b9_b3f7_177fedabeacc
  49d850e2_8fd6_07a7_8f83_58cf64932a71["buildPolyfillChunk()"]
  49d850e2_8fd6_07a7_8f83_58cf64932a71 -->|calls| a7649197_476f_f6d6_789f_bc82f5fd3ea4
  style a7649197_476f_f6d6_789f_bc82f5fd3ea4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/plugin-legacy/src/index.ts lines 956–976

function prependModenChunkLegacyGuardPlugin(): Plugin {
  let sourceMapEnabled!: boolean
  return {
    name: 'vite:legacy-prepend-moden-chunk-legacy-guard',
    configResolved(config) {
      sourceMapEnabled = !!config.build.sourcemap
    },
    renderChunk(code) {
      if (!sourceMapEnabled) {
        return modernChunkLegacyGuard + code
      }

      const ms = new MagicString(code)
      ms.prepend(modernChunkLegacyGuard)
      return {
        code: ms.toString(),
        map: ms.generateMap({ hires: 'boundary' }),
      }
    },
  }
}

Domain

Subdomains

Frequently Asked Questions

What does prependModenChunkLegacyGuardPlugin() do?
prependModenChunkLegacyGuardPlugin() is a function in the vite codebase, defined in packages/plugin-legacy/src/index.ts.
Where is prependModenChunkLegacyGuardPlugin() defined?
prependModenChunkLegacyGuardPlugin() is defined in packages/plugin-legacy/src/index.ts at line 956.
What calls prependModenChunkLegacyGuardPlugin()?
prependModenChunkLegacyGuardPlugin() is called by 1 function(s): buildPolyfillChunk.

Analyze Your Own Codebase

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

Try Supermodel Free