MCPcopy
hub / github.com/vitejs/vite / createBackCompatIdResolver

Function createBackCompatIdResolver

packages/vite/src/node/idResolver.ts:23–36  ·  view source on GitHub ↗
(
  config: ResolvedConfig,
  options?: Partial<InternalResolveOptions>,
)

Source from the content-addressed store, hash-verified

21 * breaking changes for now.
22 */
23export function createBackCompatIdResolver(
24 config: ResolvedConfig,
25 options?: Partial<InternalResolveOptions>,
26): ResolveIdFn {
27 const compatResolve = config.createResolver(options)
28 let resolve: ResolveIdFn
29 return async (environment, id, importer, aliasOnly) => {
30 if (environment.name === 'client' || environment.name === 'ssr') {
31 return compatResolve(id, importer, aliasOnly, environment.name === 'ssr')
32 }
33 resolve ??= createIdResolver(config, options)
34 return resolve(environment, id, importer, aliasOnly)
35 }
36}
37
38/**
39 * Create an internal resolver to be used in special scenarios, e.g.

Callers 9

dynamicImportVarsPluginFunction · 0.90
cssPluginFunction · 0.90
cssFunction · 0.90
sassFunction · 0.90
lessFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.90
rolldownDepPluginFunction · 0.90

Calls 2

createIdResolverFunction · 0.85
resolveFunction · 0.70

Tested by

no test coverage detected