MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / resolve

Function resolve

packages/webpack5/src/configuration/base.ts:522–548  ·  view source on GitHub ↗
(id, baseDir, importOptions)

Source from the content-addressed store, hash-verified

520 // custom resolver to resolve platform extensions in @import statements
521 // ie. @import "foo.css" would import "foo.ios.css" if the platform is ios and it exists
522 resolve(id, baseDir, importOptions) {
523 const extensions =
524 platform === 'visionos' ? [platform, 'ios'] : [platform];
525 for (const platformTarget of extensions) {
526 const ext = extname(id);
527 const platformExt = ext ? `.${platformTarget}${ext}` : '';
528
529 if (!id.includes(platformExt)) {
530 const platformRequest = id.replace(ext, platformExt);
531 const extPath = resolve(baseDir, platformRequest);
532
533 try {
534 return require.resolve(platformRequest, {
535 paths: [baseDir],
536 });
537 } catch {}
538
539 if (existsSync(extPath)) {
540 console.log(`resolving "${id}" to "${platformRequest}"`);
541 return extPath;
542 }
543 }
544 }
545
546 // fallback to postcss-import default resolution
547 return id;
548 },
549 },
550 ],
551 ],

Callers 10

angular.tsFile · 0.70
base.tsFile · 0.70
getEntryPathFunction · 0.50
getAbsoluteDistPathFunction · 0.50
getDotEnvPathFunction · 0.50
getProjectFilePathFunction · 0.50
loaderFunction · 0.50
loaderFunction · 0.50
applyMethod · 0.50

Calls 4

includesMethod · 0.80
replaceMethod · 0.80
resolveMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected