Home / Function/ polyfillsPlugin() — vite Function Reference

polyfillsPlugin() — vite Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

packages/plugin-legacy/src/index.ts lines 934–954

function polyfillsPlugin(
  imports: Set<string>,
  excludeSystemJS?: boolean,
): Plugin {
  return {
    name: 'vite:legacy-polyfills',
    resolveId(id) {
      if (id === polyfillId) {
        return id
      }
    },
    load(id) {
      if (id === polyfillId) {
        return (
          [...imports].map((i) => `import ${JSON.stringify(i)};`).join('') +
          (excludeSystemJS ? '' : `import "systemjs/dist/s.min.js";`)
        )
      }
    },
  }
}

Domain

Subdomains

Frequently Asked Questions

What does polyfillsPlugin() do?
polyfillsPlugin() is a function in the vite codebase, defined in packages/plugin-legacy/src/index.ts.
Where is polyfillsPlugin() defined?
polyfillsPlugin() is defined in packages/plugin-legacy/src/index.ts at line 934.
What calls polyfillsPlugin()?
polyfillsPlugin() 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