MCPcopy Index your code
hub / github.com/nodejs/node / tryLoadModuleUsingBaseUrl

Function tryLoadModuleUsingBaseUrl

test/fixtures/snapshot/typescript.js:43263–43276  ·  view source on GitHub ↗
(extensions, moduleName, loader, state)

Source from the content-addressed store, hash-verified

43261 return undefined;
43262 }
43263 function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, state) {
43264 var baseUrl = state.compilerOptions.baseUrl;
43265 if (!baseUrl) {
43266 return undefined;
43267 }
43268 if (state.traceEnabled) {
43269 trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, baseUrl, moduleName);
43270 }
43271 var candidate = ts.normalizePath(ts.combinePaths(baseUrl, moduleName));
43272 if (state.traceEnabled) {
43273 trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, baseUrl, candidate);
43274 }
43275 return loader(extensions, candidate, !ts.directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
43276 }
43277 /**
43278 * Expose resolution logic to allow us to use Node module resolution logic from arbitrary locations.
43279 * No way to do this with `require()`: https://github.com/nodejs/node/issues/5963

Calls 2

traceFunction · 0.85
loaderFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…