2017-03-26 22 views
-1

それ角度2 systemjs

Import {UtilClass} from '../shared/util.class'; 

私は次のエラーを持っていると私は観察するものをログロードされたファイルに検証することは、私はを使用する場合には、拡張JSを入れていないということである「../」 404 util.class /(見つかりません)

(function (global) { 

var staticPath='src/'; 

var paths = { 
    // paths serve as alias 
    'npm:': 'https://unpkg.com/' 
}; 

// map tells the System loader where to look for things 
var map = { 
    'app': 'app', 
    // angular bundles 
    '@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js', 
    '@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js', 
    '@angular/core': 'npm:@angular/core/bundles/core.umd.js', 
    '@angular/common': 'npm:@angular/common/bundles/common.umd.js', 
    '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', 
    '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', 
    '@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js', 
    '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', 
    '@angular/http': 'npm:@angular/http/bundles/http.umd.js', 
    '@angular/router': 'npm:@angular/router/bundles/router.umd.js', 
    '@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js', 
    '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', 
    '@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js', 
    '@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js', 

    // other libraries 
    'rxjs': 'npm:[email protected]', 
    'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js', 
    'ts': 'npm:[email protected]/lib/plugin.js', 
    'typescript': 'npm:[email protected]/lib/typescript.js', 
}; 

// packages tells the System loader how to load when no filename and/or no extension 
var packages = { 

    'app': { 
     main: '../..' + staticPath + '/main', 
     defaultExtension: 'js', 
     defaultJSExtensions: true 
    } 
    , 
    'rxjs': { 
     defaultExtension: 'js' 
    } 
}; 

var config = { 
    map: map, 
    packages: packages, 
    paths: paths 
}; 

System.config(config); 
})(this); 

答えて

0

ルートは相対的である場合は、このエラーは、私はそれを修正するためのより良い方法があると発生します。

var packages = { 
'app': { 
    main: '../..' + staticPath + '/main', 
    defaultExtension: 'js', 
    defaultJSExtensions: true 
} 
, 
'rxjs': { 
    defaultExtension: 'js' 
} 
}; 
//I added this and works 
packages['./../..'+staticPath+'/']={main:'main',defaultExtension: 'js'} 
関連する問題