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

Function handler

packages/vite/src/node/optimizer/rolldownDepPlugin.ts:173–197  ·  view source on GitHub ↗
(id, importer, options)

Source from the content-addressed store, hash-verified

171 resolveId: {
172 filter: { id: allExternalTypesReg },
173 async handler(id, importer, options) {
174 const kind = options.kind
175 // if the prefix exist, it is already converted to `import`, so set `external: true`
176 if (id.startsWith(convertedExternalPrefix)) {
177 return {
178 id: id.slice(convertedExternalPrefix.length),
179 external: 'absolute',
180 }
181 }
182
183 const resolved = await resolve(id, importer, kind)
184 if (resolved) {
185 // `resolved` can be javascript even when `id` matches `allExternalTypes`
186 // due to cjs resolution (e.g. require("./test.pdf") for "./test.pdf.js")
187 // or package name (e.g. import "some-package.pdf")
188 if (JS_TYPES_RE.test(resolved)) {
189 return {
190 // normalize to \\ on windows for esbuild/rolldown behavior difference: https://github.com/sapphi-red-repros/rolldown-esbuild-path-normalization
191 id: isWindows ? resolved.replaceAll('/', '\\') : resolved,
192 external: false,
193 }
194 }
195 return resolveAssets(resolved, kind)
196 }
197 },
198 },
199 load: {
200 filter: {

Callers

nothing calls this directly

Calls 12

isCSSRequestFunction · 0.90
isModuleCSSRequestFunction · 0.90
moduleListContainsFunction · 0.90
isDataUrlFunction · 0.90
isExternalUrlFunction · 0.90
normalizePathFunction · 0.90
isNodeBuiltinFunction · 0.90
resolveAssetsFunction · 0.85
resolveEntryFunction · 0.85
resolveResultFunction · 0.85
resolveFunction · 0.70
resolveMethod · 0.65

Tested by

no test coverage detected