title: Automatic ordering of exports in index.ts makes app crash
body: <p>Every time I generate something in my shared folder the index.ts file is rebuilt and exports are put in alphabetical order. This seems to break dependencies for me. Changing order manually so that dependencies is exported before classes with the dependencies makes it work again.</p>
  
  <p>If we have <code>app/shared/auth.guard.ts</code>:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { CanActivate, Router, ActivatedRouteSnapshot } from '@angular/router';
  import { Observable } from 'rxjs/Observable';
  
  import { AuthService, User } from './';
  
  @Injectable()
  export class AuthGuard implements CanActivate {
  
      constructor(private accountService: AuthService, private router: Router) { }
  
      canActivate(next: ActivatedRouteSnapshot): Observable&lt;boolean&gt; {
          let result = this.accountService.currentUser.first().map(user =&gt; user != null);
  
          let route: any[] = ['/login'];
  
          if (next.url.length) {
              route.push({ redirectUrl: next.url });
          }
  
          result.subscribe(isLoggedIn =&gt; {
              if (!isLoggedIn) {
                  this.router.navigate(route);
              }
          });
  
          return result;
      }
  }
  </code></pre>
  
  <p>and <code>app/shared/account.service.ts</code>:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Observable } from 'rxjs/Observable';
  import { BehaviorSubject } from 'rxjs/BehaviorSubject';
  
  import { User } from './';
  
  const LOCAL_STORAGE_KEY = 'currentUser';
  
  @Injectable()
  export class AuthService {
    private currentUserSubject: BehaviorSubject&lt;User&gt;;
  
    constructor() {
      this.currentUserSubject = new BehaviorSubject&lt;User&gt;(this.getUserFromLocalStorage())
      this.currentUserSubject.subscribe(user =&gt; this.setUserToLocalStorage(user));
    }
  
    logIn(userName: string, password: string) : Observable&lt;User&gt; {
      this.currentUserSubject.next({
        id: userName,
        userName: userName,
        email: userName
      });
  
      return this.currentUser.first();
    }
  
    logOut() {
      this.currentUserSubject.next(null);
    }
  
    get currentUser(): Observable&lt;User&gt; {
      return this.currentUserSubject.asObservable();
    }
  
    private getUserFromLocalStorage(): User {
      let userString = localStorage.getItem(LOCAL_STORAGE_KEY);
  
      if (!userString) {
        return null;
      }
  
      return JSON.parse(userString);
    }
  
    private setUserToLocalStorage(user: User) {
      if (user) {
        localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(user));
      }
      else {
        localStorage.removeItem(LOCAL_STORAGE_KEY);
      }
    }
  
  }
  </code></pre>
  
  <p>This doesn't work:</p>
  
  <pre><code>export * from './auth.guard';
  export * from './auth.service';
  </code></pre>
  
  <p><code>Unhandled Promise rejection: Error: Cannot resolve all parameters for 'AuthGuard'(undefined, Router). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'AuthGuard' is decorated with Injectable.</code></p>
  
  <p>This works:</p>
  
  <pre><code>export * from './auth.service';
  export * from './auth.guard';
  </code></pre>
  
  <p>From what I noticed this doesn't apply to all. For example can my user model be exported after auth service and it works fine.</p>
  
  <p>I wish I didn't have to change this manually every time. Is there a workaround available? Could I structure the files in a different way?</p>
  
  <p>Dependencies from <code>package.json</code>:</p>
  
  <pre><code>"@angular/common": "^2.0.0-rc.2",
  "@angular/compiler": "^2.0.0-rc.2",
  "@angular/core": "^2.0.0-rc.2",
  "@angular/forms": "^0.1.0",
  "@angular/http": "^2.0.0-rc.2",
  "@angular/platform-browser": "^2.0.0-rc.2",
  "@angular/platform-browser-dynamic": "^2.0.0-rc.2",
  "@angular/router": "^3.0.0-alpha.7",
  "bootstrap": "^3.3.6",
  "es6-shim": "0.35.1",
  "moment": "^2.13.0",
  "ng2-bootstrap": "^1.0.17",
  "reflect-metadata": "0.1.3",
  "rxjs": "5.0.0-beta.6",
  "slideout": "^0.1.12",
  "systemjs": "0.19.26",
  "zone.js": "0.6.12"
  </code></pre>
  
  <p>devDependencies:</p>
  
  <pre><code>"angular-cli": "1.0.0-beta.6"
  </code></pre>