如果我有文件的结构是这样的:角2打字稿进口深目录
- 应用
- 车型
- model1.ts
- model2.ts
- model3。 ts
- index.ts 个
- 服务
- serviceGroup1
- serviceGroup1Service1.ts
- serviceGroup1Service2.ts
- index.ts
- serviceGroup2
- serviceGroup3
- index.ts
- 车型
tsconfig.json:
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"mapRoot": "/",
"module": "commonjs",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": false,
"outDir": "../dist/",
"rootDir": ".",
"sourceMap": true,
"target": "es5",
"inlineSources": true
}
如何使所有的模型公开,并将其导入这样的: serviceGroup1Service1.ts:
import * as models from 'models';
更新文件树
页更新的文件
增加了新的barells到system.config.ts
'app',
'app/models',
'app/services'
试图在serviceGroup1Service1.ts使用
import * from 'app/models'
有一个错误“无法找到模块“应用程序/模型'
但是
import { Component } from '@angular/core'
效果很好。如何为我的组件做到这一点?
感谢您的回答。但仍有错误“[ts]找不到模块”。 –