import path from 'path'; import ps from '../paths'; import getProjectConfig from './getProjectConfig'; export default () => { const tsconfig = getProjectConfig(); const {paths, baseUrl} = tsconfig.compilerOptions; return Object.fromEntries( Object.entries(paths) .filter(([, pathValues]) => (pathValues as any).length > 0) .map(([pathKey, pathValues]) => { const key = pathKey.replace('/*', ''); const value = path.resolve( path.dirname(ps.appTsConfig), baseUrl, pathValues[0].replace('/*', '') ); return [ [key, value], ['~' + key, value], ]; }) .flat() ); };