Home / Function/ recordAndRemovePolyfillBabelPlugin() — vite Function Reference

recordAndRemovePolyfillBabelPlugin() — vite Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  9b43ba2f_f840_d828_0465_b829e6574d45["recordAndRemovePolyfillBabelPlugin()"]
  9776ecb6_00c0_b3b9_b3f7_177fedabeacc["index.ts"]
  9b43ba2f_f840_d828_0465_b829e6574d45 -->|defined in| 9776ecb6_00c0_b3b9_b3f7_177fedabeacc
  cf21e8d8_cce6_30a7_7732_696ed5cdf103["viteLegacyPlugin()"]
  cf21e8d8_cce6_30a7_7732_696ed5cdf103 -->|calls| 9b43ba2f_f840_d828_0465_b829e6574d45
  style 9b43ba2f_f840_d828_0465_b829e6574d45 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/plugin-legacy/src/index.ts lines 990–1004

function recordAndRemovePolyfillBabelPlugin(
  polyfills: Set<string>,
): BabelPlugin {
  return ({ types: t }: { types: typeof BabelTypes }): BabelPlugin => ({
    name: 'vite-remove-polyfill-import',
    post({ path }) {
      path.get('body').forEach((p) => {
        if (t.isImportDeclaration(p.node)) {
          polyfills.add(p.node.source.value)
          p.remove()
        }
      })
    },
  })
}

Domain

Subdomains

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free