( id: string, importer: string | undefined, options: NodeResolveWithViteOptions, )
| 12 | * Resolve like Node.js using Vite's resolution algorithm with preconfigured options. |
| 13 | */ |
| 14 | export 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 | } |
no test coverage detected