mik*_*969 6 import typescript angular
我正在尝试实现此链接中描述的导入桶结构(您可能需要向下滚动一下):
https://angular.io/docs/ts/latest/guide/style-guide.html#!#application-structure
我面临的问题是我正在创建和引用的index.ts文件
import {...} from './shared/services';
Run Code Online (Sandbox Code Playgroud)
在运行时找不到并且正在抛出404.如果我参考像这样的模块
import {...} from './shared/services/index';
Run Code Online (Sandbox Code Playgroud)
它工作正常.问题只出现在运行时,打字稿不会抱怨并成功编译.我在一个plunker中重复了这个问题:
https://plnkr.co/edit/ClE76zuihFTETLDGehnd?p=preview
您可以在控制台中看到错误.
在此先感谢您的帮助!
我终于找到了一些东西:https://www.reddit.com/r/Angular2/comments/4i2d9x/support_problem_with_barrels/
看来,这对于 来说不容易实现SystemJS,因为它无法处理桶文件。
要解决此问题,您可以像之前那样添加每个文件[...]/index,也可以将它们添加为包SystemJS
| 归档时间: |
|
| 查看次数: |
740 次 |
| 最近记录: |