小编mik*_*969的帖子

Angular2 - 导入桶在运行时导致404

我正在尝试实现此链接中描述的导入桶结构(您可能需要向下滚动一下):

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

您可以在控制台中看到错误.

在此先感谢您的帮助!

import typescript angular

6
推荐指数
1
解决办法
740
查看次数

标签 统计

angular ×1

import ×1

typescript ×1