我有一个相当标准的项目结构
src
|
+--app
|
+--components
| |
| +-component.ts
|
+--entities
|
+--entity.ts在entity.ts,我有
export class Entity {
...在component.ts,我有
import { Entity } from 'app/entities/entity';当我运行ng build时,一切都很好。然而,Webclipse抱怨说它是Cannot find module 'app/entities/entity'。
如果我将component.ts改为阅读
import { Entity } from '../entities/entity';它既适用于网络启示录,也适用于ng build。然而,由于公司的编码实践的原因,这并不是架构师所习惯的改变,我同意这一点。
我如何才能让Webclipse识别这个导入呢?比如说,是否有一种为Webclipse编译器配置导入根目录的方法?
发布于 2017-03-06 13:58:00
事实证明,事情比预期的要简单。我的tsconfig.json开始时如下:
{
"compilerOptions": {
"baseUrl": "",我把最后一行改为读
"baseUrl": ".",现在一切正常。感谢阿伦·哈达德,因为他的评论把我推向了正确的方向。
https://stackoverflow.com/questions/42627076
复制相似问题