Currently, I am in the process of learning how to create a Gulp build process with Angular 2 and Typescript. Following the Quick Start guide has allowed me to get everything up and running smoothly. However, I have decided to experiment with different folder structures, which has led to some issues. In particular, my app.component.ts file is struggling to find
import { Component } from 'node_modules/@angular/core';
. To solve this, I changed the path to import { Component } from '../../../manager/node_modules/@angular/core';
, which works, but seems a bit cumbersome compared to other configurations.
My current directory looks like this:
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
In my app.component.ts file:
/// <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 { }
I have a couple of questions:
Is there a way I can reference
@angular/core
without specifying the entire path?Can I eliminate the need for
<reference path="">
?
The angular2-seed project manages to achieve this more elegantly, but I haven't been able to figure out their method yet. I suspect they might have a file handling the references for them.