在跟踪Angular2 Quickstart for beta.0时无法加载boot.js.

Mik*_*ird 2 javascript systemjs angular

我已升级到Angular2@2.0.0-beta.0.app.ts和boot.ts都在我的src目录中(与Quickstart中的app相比).src和index.html位于项目目录中 - angular2-oPost,与Quickstart示例类似.我已经尝试了很多东西但总是得到 - 找不到boot.js,错误加载boot.js我的index.html加载脚本全部加载并且是:

<base href="/src"/>
<!--1. Load library links for ES6-related imports, then load angular2 modules -->
<script src="./angular2-oPost/node_modules/systemjs/dist/system.src.js"></script>
<script src="./angular2-oPost/node_modules/angular2/bundles/angular2-polyfills.min.js"></script>
<script src="./angular2-oPost/node_modules/rxjs/bundles/Rx.js"></script> 
<script src="./angular2-oPost/node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="./angular2-oPost/node_modules/angular2/bundles/router.min.js"></script>
<!-- 2. Configure SystemJS -->
<script>System.config({
  packages: {
    src: {
      format: 'register',
      defaultExtension: 'js'
      }
    }
  });
  System.import('src/boot').then(null, console.error.bind(console));
</script>
Run Code Online (Sandbox Code Playgroud)

boot.ts来自Quickstart,简单地说:

"use strict";
import { bootstrap }    from 'angular2/platform/browser';
import { ResidenceApp } from './app';
bootstrap( ResidenceApp );
Run Code Online (Sandbox Code Playgroud)

app.ts有一些导入语句,@ Component,@ View,@ RouteConfig和一个bootstrap语句.没有加载.Console错误声明是:

GET http://localhost/src/boot.js [HTTP/1.1 404 Not Found 31ms]
15:53:05.058 Error: Unable to load script http://localhost/src/boot.js
Error loading http://localhost/src/boot.js
Stack trace: error@http://localhost/angular2-oPost/node_modules/systemjs/dist/system.src.js:2506:18
[2]</</r.prototype.run@http://localhost/angular2-oPost/node_modules/angular2/bundles/angular2-polyfills.min.js:1:1994
[2]</</r.prototype.bind/<@http://localhost/angular2-oPost/node_modules/angular2/bundles/angular2-polyfills.min.js:1:1718
Run Code Online (Sandbox Code Playgroud)

我正在使用systemjs版本0.19.9如果我将System.import语句更改为

System.import('src/boot.js')
Run Code Online (Sandbox Code Playgroud)

然后找到并加载启动,但app.js成为新问题,等等其他组件,如果它(或它们)是硬编码的.

需要改变什么?

lam*_*der 5

尝试以下加载和配置库的顺序,

<!-- ES6-related imports -->
<script src="/node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="/node_modules/es6-shim/es6-shim.min.js"></script>
<script src="/node_modules/systemjs/dist/system.js"></script>

<script>
//configure system loader
     System.config({defaultJSExtensions: true});
</script>

<script src="/node_modules/rxjs/bundles/Rx.js"></script>
<script src="/node_modules/angular2/bundles/angular2.min.js"></script>

<script>
 //bootstrap the Angular2 application
 System.import('dist/hello').catch(console.log.bind(console));
</script>
Run Code Online (Sandbox Code Playgroud)

参考:https://github.com/pkozlowski-opensource/ng2-play/blob/master/index.html