2016-06-02 7 views
0

레이아웃 페이지에서 boot.js를 가져 오려고하면 404 오류가 계속 발생합니다. 나는 (wwwroot에에서 본) index.html을 사용할 때 enter image description hereSystemJS Angular2 부트 로더를 찾을 수 없음

모든 것이 잘 작동 :

<!-- Configure SystemJS --> 
<script src="/appScripts/config.js"></script> 
<script> 
     System.import('/appScripts/boot') 
       .then(null, console.error.bind(console)); 
</script> 

가 여기 내 폴더 구조입니다 : 여기

enter image description here 내가 그것을 가져올 사용하고있는 코드입니다 하지만 내 config.js입니다 여기에

/views/shared/_layout.cshtml에서 시도하지 않을 때

(function (global) { 

    // map tells the System loader where to look for things 
    var map = { 
     'app': 'appScripts', // 'dist', 
     'rxjs': 'libs/rxjs', 
     'angular2-in-memory-web-api': 'libs/angular2-in-memory-web-api', 
     '@angular': 'libs/@angular' 
    }; 

    // packages tells the System loader how to load when no filename and/or no extension 
    var packages = { 
     'app': { main: 'boot.js', defaultExtension: 'js' }, 
     'rxjs': { defaultExtension: 'js' }, 
     'angular2-in-memory-web-api': { defaultExtension: 'js' }, 
    }; 

    var packageNames = [ 
     '@angular/common', 
     '@angular/compiler', 
     '@angular/core', 
     '@angular/http', 
     '@angular/platform-browser', 
     '@angular/platform-browser-dynamic', 
     '@angular/router', 
     '@angular/router-deprecated', 
     '@angular/testing', 
     '@angular/upgrade', 
    ]; 

    // add package entries for angular packages in the form '@angular/common': { main: 'index.js', defaultExtension: 'js' } 
    packageNames.forEach(function (pkgName) { 
     packages[pkgName] = { main: 'index.js', defaultExtension: 'js' }; 
    }); 

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

    // filterSystemConfig - index.html's chance to modify config before we register it. 
    if (global.filterSystemConfig) { global.filterSystemConfig(config); } 

    System.config(config); 

})(this); 

도움을 주셔서 감사 드리며 자세한 정보가 필요하면 알려주세요.

답변

1

나는 이것을 시도했지만 그것이 모두를 추적하는 것은 어렵다고 생각했습니다. 여기 내가 어떻게 이것을 해결 했는가. baseURL 행을 주목하십시오.

<!-- Configure SystemJS --> 
<script>System.config({ baseURL: '/' });</script> 
<script src="/appScripts/config.js"></script> 
<script> 
    System.import('appScripts/boot').catch(console.log.bind(console)); 
</script> 
관련 문제