For example, inside you component you want to import a file from two up directory:

import store from '../../store'

This becomes a little bit problematic because the component can be really nested.

To solve this problem, we can define "paths" in tsconfig.json:

{
...
"compilerOptions": {
"baseUrl": ".",
"paths": {
"store": ["src/store.ts"]
},
...
"target": "es5"
}
}

Now for each component, we can just use:

import store from 'store'

[Angular] Omit relative path by set up in tsconfig.json的更多相关文章

  1. RPO(Relative Path Overwrite)

    Conception(Relative vs Absolute) Abosolute Path: "/etc/hosts"(in Linux), "C:\Windows\ ...

  2. How to put a relative path for a DLL statically loaded?

    How to put a relative path for a DLL statically loaded? I have a DLL made in Delphi 7/Windows XP tha ...

  3. Security Report: Stop using relative path to import CSS files

    Detecting and exploiting path-relative stylesheet import (PRSSI) vulnerabilities   Early last year G ...

  4. Hive报错 Failed with exception java.io.IOException:java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:user.name%7D

    报错信息如下 Failed with exception java.io.IOException:java.lang.IllegalArgumentException: java.net.URISyn ...

  5. hive启动时报错 java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D at org.apache.hadoop.fs.Path.initialize

    错误提示信息如下 错误信息如下 [root@node1 bin]# ./hive Logging initialized -bin/lib/hive-common-.jar!/hive-log4j.p ...

  6. c# Relative Path convert to Absolute Path

    Reference: http://stackoverflow.com/questions/4796254/relative-path-to-absolute-path-in-c http://sta ...

  7. firefox ie 比较 relative path

    relative path 对于firefox ie 来说是不同的 在ie中 <base href="/">起基础url作用 此时 <a href="& ...

  8. 规范 : angular ui router path & params

    在seo文章中提到url的path 必须是 why-us,而不是whyUS 所以定了规范,所有的path 必须why-us path ?后尾的是用来filter的,所以可以WhyUs 如果是不需要给s ...

  9. FAILED java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI:hdfs:192.*

    运行的参数配置 hdfs:192.168.58.180/cf/userItem.txt 应该写成 hdfs://192.*

随机推荐

  1. 不仅仅是MVC

    MVC Smart MV Three tier 等等

  2. Spark RPC

    在Spark中,对于网络调用的底层封装(粘包拆包,编解码,链路管理等)都是在common/network-common包中实现的(详见[common/network-common]).在common/ ...

  3. Datatable foeach 遍历

    //1.创建 datatable DataTable dt = new DataTable("dtDemo");//可以给表创建一个名字,datatable //2.给表加个列名: ...

  4. 开机显示 invalid partition table

    解决方法:进入你的BIOS, 然后设置你装系统的盘(SSD,或者磁盘)为第一启动位置处即可. 具体可参考文章电脑开机出现Invalid Partition Table怎么修复?解决

  5. jQuery过滤选择器具体解释

    基本过滤选择器 选取第一个元素(:first) //选择第一个div元素. $('#btn1').click(function(){ $('div:first').css("backgrou ...

  6. open阶段的一致性检验(二)

    SQL> select * from v$version where rownum=1; BANNER --------------------------------------------- ...

  7. 更为详细的Txtsetup.sif文件解释

    更为详细的Txtsetup.sif文件解释;代码页定义, 以免文本安装模式下无法正常显示简体中文 (以下基本都是跟简体中文相关的, 不同语言版本的 Windows, 此处定义也不同)[nls]Ansi ...

  8. 图片裁剪的js有哪些(整理)

    图片裁剪的js有哪些(整理) 一.总结 一句话总结:如果用了amaze框架就去amaze框架的插件库里面找图片裁剪插件,如果没用,jcrop和cropper都不错. 1.amazeui的插件库中有很多 ...

  9. numpy_basic3

    矩陣 矩阵是numpy.matrix类类型的对象,该类继承自numpy.ndarray,任何针对多维数组的操作,对矩阵同样有效,但是作为子类矩阵又结合其自身的特点,做了必要的扩充,比如:乘法计算.求逆 ...

  10. Unity5中的粒子缩放(附测试源码)

    本文章由cartzhang编写,转载请注明出处. 所有权利保留. 文章链接:http://blog.csdn.net/cartzhang/article/details/49363241 作者:car ...