Home / File/ modulePreloadPolyfill.ts — vite Source File

modulePreloadPolyfill.ts — vite Source File

Architecture documentation for modulePreloadPolyfill.ts, a typescript file in the vite codebase. 5 imports, 3 dependents.

File typescript PluginSystem LegacySupport 5 imports 3 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  2dc11bc2_35a1_d20e_bf9f_1a3c2bbe3f85["modulePreloadPolyfill.ts"]
  5abb8c87_ffcb_f2d4_7421_e36705d9e5c7["plugin.ts"]
  2dc11bc2_35a1_d20e_bf9f_1a3c2bbe3f85 --> 5abb8c87_ffcb_f2d4_7421_e36705d9e5c7
  1dc2cf7d_5d97_c778_8c33_6449a7607aef["Plugin"]
  2dc11bc2_35a1_d20e_bf9f_1a3c2bbe3f85 --> 1dc2cf7d_5d97_c778_8c33_6449a7607aef
  db4d54eb_be78_e7bb_fac3_7f8913198d1d["filter"]
  2dc11bc2_35a1_d20e_bf9f_1a3c2bbe3f85 --> db4d54eb_be78_e7bb_fac3_7f8913198d1d
  8632597a_0333_2fd2_cdb3_954e50be6e8d["experimental"]
  2dc11bc2_35a1_d20e_bf9f_1a3c2bbe3f85 --> 8632597a_0333_2fd2_cdb3_954e50be6e8d
  2616bf8c_8895_7af5_fb6e_8424b9e71ea7[".."]
  2dc11bc2_35a1_d20e_bf9f_1a3c2bbe3f85 --> 2616bf8c_8895_7af5_fb6e_8424b9e71ea7
  0d441474_bd18_6871_34d1_98946e530e5a["modulePreloadPolyfill.spec.ts"]
  0d441474_bd18_6871_34d1_98946e530e5a --> 2dc11bc2_35a1_d20e_bf9f_1a3c2bbe3f85
  f8fe0737_718a_5509_b722_473f207d5906["html.ts"]
  f8fe0737_718a_5509_b722_473f207d5906 --> 2dc11bc2_35a1_d20e_bf9f_1a3c2bbe3f85
  3bf7f0de_2a9f_6f04_cead_0321b3b7af01["index.ts"]
  3bf7f0de_2a9f_6f04_cead_0321b3b7af01 --> 2dc11bc2_35a1_d20e_bf9f_1a3c2bbe3f85
  style 2dc11bc2_35a1_d20e_bf9f_1a3c2bbe3f85 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { exactRegex } from 'rolldown/filter'
import { viteModulePreloadPolyfillPlugin as nativeModulePreloadPolyfillPlugin } from 'rolldown/experimental'
import { type ResolvedConfig, perEnvironmentPlugin } from '..'
import type { Plugin } from '../plugin'

export const modulePreloadPolyfillId = 'vite/modulepreload-polyfill'
const resolvedModulePreloadPolyfillId = '\0' + modulePreloadPolyfillId + '.js'

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

Dependencies

Frequently Asked Questions

What does modulePreloadPolyfill.ts do?
modulePreloadPolyfill.ts is a source file in the vite codebase, written in typescript. It belongs to the PluginSystem domain, LegacySupport subdomain.
What functions are defined in modulePreloadPolyfill.ts?
modulePreloadPolyfill.ts defines 1 function(s): modulePreloadPolyfillPlugin.
What does modulePreloadPolyfill.ts depend on?
modulePreloadPolyfill.ts imports 5 module(s): .., Plugin, experimental, filter, plugin.ts.
What files import modulePreloadPolyfill.ts?
modulePreloadPolyfill.ts is imported by 3 file(s): html.ts, index.ts, modulePreloadPolyfill.spec.ts.
Where is modulePreloadPolyfill.ts in the architecture?
modulePreloadPolyfill.ts is located at packages/vite/src/node/plugins/modulePreloadPolyfill.ts (domain: PluginSystem, subdomain: LegacySupport, directory: packages/vite/src/node/plugins).

Analyze Your Own Codebase

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

Try Supermodel Free