2016-08-03 16 views
0

Hier zu arbeiten ist mein System-config.ts:Angular 2-System-config.ts scheint nicht mit meinem app spezifischem Barrel

'use strict'; 

// SystemJS configuration file, see links for more information 
// https://github.com/systemjs/systemjs 
// https://github.com/systemjs/systemjs/blob/master/docs/config-api.md 

/*********************************************************************************************** 
* User Configuration. 
**********************************************************************************************/ 
/** Map relative paths to URLs. */ 
const map: any = { 
    'moment': 'vendor/moment/moment.js', 
    'ng2-bootstrap': 'vendor/ng2-bootstrap' 
}; 

/** User packages configuration. */ 
const packages: any = { 
    'moment': { 
    format: 'cjs' 
    }, 
    'ng2-bootstrap': { 
    format: 'cjs', 
    defaultExtension: 'js', 
    main: 'ng2-bootstrap.js' 
    } 
}; 

//////////////////////////////////////////////////////////////////////////////////////////////// 
/*********************************************************************************************** 
* Everything underneath this line is managed by the CLI. 
**********************************************************************************************/ 
const barrels: string[] = [ 
    // Angular specific barrels. 
    '@angular/core', 
    '@angular/common', 
    '@angular/compiler', 
    '@angular/forms', 
    '@angular/http', 
    '@angular/router', 
    '@angular/platform-browser', 
    '@angular/platform-browser-dynamic', 

    // Thirdparty barrels. 
    'rxjs', 

    // App specific barrels. 
    'app', 
    'app/shared', 
    'app/photos' 
    /** @cli-barrel */ 
]; 

const cliSystemConfigPackages: any = {}; 
barrels.forEach((barrelName: string) => { 
    cliSystemConfigPackages[barrelName] = { main: 'index' }; 
}); 

/** Type declaration for ambient System. */ 
declare var System: any; 

// Apply the CLI SystemJS configuration. 
System.config({ 
    map: { 
    '@angular': 'vendor/@angular', 
    'rxjs': 'vendor/rxjs', 
    'main': 'main.js' 
    }, 
    packages: cliSystemConfigPackages 
}); 

// Apply the user's configuration. 
System.config({ map, packages }); 

Ich bin in der Lage, alle Module mit Ausnahme für die App importieren bestimmte Fässer.

Also, import { AlertComponent } from 'ng2-bootstrap/ng2-bootstrap'; funktioniert gut.

Jedoch nicht import { PhotoService } from 'app/shared';.

Ich exportiere korrekt, denn wenn ich import { PhotoService } from '../../shared'; mache, funktioniert es.

Kann mir jemand helfen? Was mache ich falsch?

Antwort

0

Muss ein relativer Pfad sein.

import { PhotoService } from './app/shared'; 

Deshalb funktioniert ../../* funktioniert. Hat nichts mit System zu tun.