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

Function nodeResolveWithVite

packages/vite/src/node/nodeResolve.ts:14–43  ·  view source on GitHub ↗
(
  id: string,
  importer: string | undefined,
  options: NodeResolveWithViteOptions,
)

Source from the content-addressed store, hash-verified

12 * Resolve like Node.js using Vite's resolution algorithm with preconfigured options.
13 */
14export function nodeResolveWithVite(
15 id: string,
16 importer: string | undefined,
17 options: NodeResolveWithViteOptions,
18): string | undefined {
19 return tryNodeResolve(id, importer, {
20 root: options.root,
21 isBuild: true,
22 isProduction: true,
23 preferRelative: false,
24 tryIndex: true,
25 mainFields: [],
26 conditions: [
27 'node',
28 ...(isModuleSyncConditionEnabled ? ['module-sync'] : []),
29 ],
30 externalConditions: [],
31 external: [],
32 noExternal: [],
33 dedupe: [],
34 extensions: DEFAULT_EXTENSIONS,
35 preserveSymlinks: false,
36 tsconfigPaths: false,
37 // Intentionally disable package cache for now as consumers don't need it
38 packageCache: undefined,
39 isRequire: options.isRequire,
40 builtins: nodeLikeBuiltins,
41 disableOptionalPeerDepHandling: true,
42 })?.id
43}

Callers 3

handlerFunction · 0.90
loadPreprocessorPathFunction · 0.90
loadTerserPathFunction · 0.90

Calls 1

tryNodeResolveFunction · 0.90

Tested by

no test coverage detected