@tanstack/react-query
Version:
Hooks for managing, caching and syncing asynchronous and remote data in React
18 lines (14 loc) • 478 B
JavaScript
// @ts-check
import path from 'node:path'
import ts from 'typescript'
const tsconfig = ts.readConfigFile(
path.resolve(__dirname, '..', 'tsconfig.json'),
ts.sys.readFile,
).config
export const dynamicAliases = Object.entries(
tsconfig.compilerOptions.paths || {},
).reduce((aliases, [key, [value]]) => {
const aliasKey = key.replace('/*', '')
aliases[aliasKey] = path.resolve(value.replace('/*', ''))
return aliases
}, /** @type {Record<string, string>} */ ({}))