14 lines
357 B
TypeScript
14 lines
357 B
TypeScript
import { type ConfigLoaderSuccessResult, createMatchPath } from 'tsconfig-paths'
|
|
|
|
export function resolveImport(
|
|
importPath: string,
|
|
config: Pick<ConfigLoaderSuccessResult, 'absoluteBaseUrl' | 'paths'>,
|
|
) {
|
|
return createMatchPath(config.absoluteBaseUrl, config.paths)(
|
|
importPath,
|
|
undefined,
|
|
() => true,
|
|
['.ts', '.tsx', '.vue'],
|
|
)
|
|
}
|