最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to get the output of the path alias from typescript? - Stack Overflow

programmeradmin4浏览0评论

Is there a way to get an output from the typescript compiler that tells me where it's resolving each file from the aliases?

The general idea is that if I have a lot of paths alias split across multiple projects which all pull from each other, I want to get the absolute path of each import.

So that, given something like this:

// packages/project-a/example.ts
import {Service} from '@workspace/project/service';

I would be able to get a file which contains the information from how it resolved it.

{
  file: 'packages/project-a/example.ts',
  import: 'Service',
  alias: '@workspace/project/service',
  source: 'packages/project-c/index.ts'
}
发布评论

评论列表(0)

  1. 暂无评论