MCPcopy
hub / github.com/ampproject/amphtml / getImportResolver

Function getImportResolver

build-system/babel-config/import-resolver.js:64–79  ·  view source on GitHub ↗

* Import map configuration. * @param {'preact' | 'react' | null} buildFor determines whether to include preact or react aliases or neither. By default, uses preact aliases (in addition to jsconfig paths). * @return {object}

(buildFor = 'preact')

Source from the content-addressed store, hash-verified

62 * @return {object}
63 */
64function getImportResolver(buildFor = 'preact') {
65 return {
66 root: ['.'],
67 alias: {
68 ...readJsconfigPaths(),
69 ...(buildFor ? moduleAliases(buildFor) : {}),
70 },
71 extensions: ['.js', '.jsx', '.ts', '.tsx'],
72 stripExtensions: [],
73 babelOptions: {
74 caller: {
75 name: 'import-resolver',
76 },
77 },
78 };
79}
80
81/**
82 * Produces an alias map with paths relative to the provided root.

Callers 4

.eslintrc.jsFile · 0.85
getRelativeAliasMapFunction · 0.85
getImportResolverPluginFunction · 0.85
resolvePathFunction · 0.85

Calls 2

readJsconfigPathsFunction · 0.85
moduleAliasesFunction · 0.85

Tested by

no test coverage detected