tsconfig.json 路径模式
有什么方法可以按路径模式包含文件吗?例如,我目前正在我的脚本中执行此操作:
import '../../../../myresource/src/shared/my-interface'
但是,我想简单地使用这个:
import '@myresource/shared/my-interface'
请注意,在最后一个示例中,已跳过指定“src”文件夹。另外,“myresource”将更改为匹配该路径中的任何文件夹(“myresource”、“myresource1”、“myresource2”等),所以我想知道是否有任何解决方案不需要我添加tsconfig.json 的“paths”对象内的每个特定文件夹
Is there any way to include files by path pattern? For example, I am currently doing this in my scripts:
import '../../../../myresource/src/shared/my-interface'
However, I would like to simply use this:
import '@myresource/shared/my-interface'
Notice that in the last example, specifying the 'src' folder has been skipped. Also, 'myresource' would be changed to match any folder at that path ('myresource', 'myresource1', 'myresource2', etc..), so I would like to know if there's any solution which would not require me to add each specific folder inside the 'paths' object of the tsconfig.json
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在
tsconfig.json
中执行此操作(示例):您还可以根据需要自定义路径。
You can do this in your
tsconfig.json
(example):You can also customize the paths for your needs.