我在學習並使用Angular 2和Typescript創建一個Gulp構建過程。我沿着快速入門,一切正常。現在我試圖分支並嘗試做一些不同的事情。我想要做的是使用不同的文件夾結構,我遇到的問題與我的app.component.ts文件發現import { Component } from 'node_modules/@angular/core';
。我已經將該文件更改爲import { Component } from '../../../manager/node_modules/@angular/core';
,它可以正常工作,但我已經看到其他人有不同的文件夾結構,並且他們不使用長目錄路徑。Angular 2 Typescript Typings Path問題
目前我的文件夾結構如下:
build
- css
- js
// all compiled files end up here
manager
- node_modules
- typings
gulpfile.ts
typings.json
package.json
tsconfig.json
source
app.component.ts
main.ts
app.component.ts
/// <reference path="../manager/typings/index.d.ts" />
import { Component } from '../manager/node_modules/@angular/core';
@Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>'
})
export class AppComponent { }
我的問題是:
我可以引用
@angular/core
而無需編寫走出整條路?有沒有辦法可以省略
<reference path="">
?
angular2-seed項目可以做到這一點,但我無法弄清楚他們是如何做到的。我確定他們有一個爲他們做文件參考的文件。
我搬我的文件,它的工作。謝謝! – Mike
我的榮幸@Mike :) –