Home / Function/ modulePreloadPolyfillPlugin() — vite Function Reference

modulePreloadPolyfillPlugin() — vite Function Reference

Architecture documentation for the modulePreloadPolyfillPlugin() function in modulePreloadPolyfill.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  0ea86def_0529_bcb2_7c6a_c492d76eb972["modulePreloadPolyfillPlugin()"]
  2dc11bc2_35a1_d20e_bf9f_1a3c2bbe3f85["modulePreloadPolyfill.ts"]
  0ea86def_0529_bcb2_7c6a_c492d76eb972 -->|defined in| 2dc11bc2_35a1_d20e_bf9f_1a3c2bbe3f85
  b1b40b5b_3e43_2197_dea0_d36389d312a1["resolvePlugins()"]
  b1b40b5b_3e43_2197_dea0_d36389d312a1 -->|calls| 0ea86def_0529_bcb2_7c6a_c492d76eb972
  dfa3f5a8_b519_cb65_4b7e_9d4824406fd4["perEnvironmentPlugin()"]
  0ea86def_0529_bcb2_7c6a_c492d76eb972 -->|calls| dfa3f5a8_b519_cb65_4b7e_9d4824406fd4
  style 0ea86def_0529_bcb2_7c6a_c492d76eb972 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/modulePreloadPolyfill.ts lines 9–37

export function modulePreloadPolyfillPlugin(config: ResolvedConfig): Plugin {
  if (config.isBundled) {
    return perEnvironmentPlugin(
      'native:modulepreload-polyfill',
      (environment) => {
        return nativeModulePreloadPolyfillPlugin({
          isServer: environment.config.consumer !== 'client',
        })
      },
    )
  }

  return {
    name: 'vite:modulepreload-polyfill',
    resolveId: {
      filter: { id: exactRegex(modulePreloadPolyfillId) },
      handler(_id) {
        return resolvedModulePreloadPolyfillId
      },
    },
    load: {
      filter: { id: exactRegex(resolvedModulePreloadPolyfillId) },
      handler(_id) {
        // Should resolve to an empty module in dev
        return ''
      },
    },
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does modulePreloadPolyfillPlugin() do?
modulePreloadPolyfillPlugin() is a function in the vite codebase, defined in packages/vite/src/node/plugins/modulePreloadPolyfill.ts.
Where is modulePreloadPolyfillPlugin() defined?
modulePreloadPolyfillPlugin() is defined in packages/vite/src/node/plugins/modulePreloadPolyfill.ts at line 9.
What does modulePreloadPolyfillPlugin() call?
modulePreloadPolyfillPlugin() calls 1 function(s): perEnvironmentPlugin.
What calls modulePreloadPolyfillPlugin()?
modulePreloadPolyfillPlugin() is called by 1 function(s): resolvePlugins.

Analyze Your Own Codebase

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

Try Supermodel Free