Angular 2 Typescript System.Src transpiler与gulptask一起工作

Angular 2 Typescript System.Src transpiler与gulptask一起工作,typescript,gulp,angular,Typescript,Gulp,Angular,我对打字稿和Angular2还不熟悉,但是 我的设置如下: 我在站点根目录下没有应用程序文件夹,而是有一个src\app文件夹,然后在我的gulp任务中,我编译我的类型脚本如下: gulp.task('copy:libs', ['clean'], function () { return gulp.src([ 'node_modules/es6-shim/es6-shim.min.js', 'node_modules/systemjs/dist/system-po

我对打字稿和Angular2还不熟悉,但是

我的设置如下:

我在站点根目录下没有应用程序文件夹,而是有一个src\app文件夹,然后在我的gulp任务中,我编译我的类型脚本如下:

gulp.task('copy:libs', ['clean'], function () {
return gulp.src([
        'node_modules/es6-shim/es6-shim.min.js',
        'node_modules/systemjs/dist/system-polyfills.js',
        'node_modules/angular2/es6/dev/src/testing/shims_for_IE.js',
        'node_modules/angular2/bundles/angular2-polyfills.js',
        'node_modules/systemjs/dist/system.src.js',
        'node_modules/rxjs/bundles/Rx.js',
        'node_modules/angular2/bundles/angular2.dev.js'
    ])
    .pipe(gulp.dest(destination + '/js'));
}))

目的地:

const destination = './UI/assets';
到目前为止还不错,但现在是棘手的部分:

在我的destination+/app文件夹中,我获得了已编译的javascript文件,但在index.html文件中使用它们时:

<script>
    System.config({
        paths: {
            'app/*': '/UI/assets/app/*'
        },
    packages: {
      app: {
        format: 'register',
        defaultExtension: 'js'
      }
    }
  });
  System.import('app/main.js')
        .then(null, console.error.bind(console));
</script>

System.config({
路径:{
“app/*”:“/UI/assets/app/*”
},
套餐:{
应用程序:{
格式:'寄存器',
defaultExtension:'js'
}
}
});
System.import('app/main.js')
.then(null,console.error.bind(console));
但是系统src在我的app.component上得到一个404 inside main.js,它在typescript中注册如下:

从“./app.component”导入{AppComponent}

如果我在编译后的app.component.js文件中更改为./app.component.js,这是可行的,但是我如何正确地解决这个问题呢

我的tsconfig是直接从angular 2 getting Start复制的


我的systemjs模块应该如何配置才能工作?现在它找不到任何js文件。

我修复了这个问题。我缺少的主要是baseURL:

<script>
        System.config({
            baseURL : '/node_modules'
        });
        System.defaultJSExtensions = true;

        System.import('app/main.js')
            .then(null, console.error.bind(console));
    </script>

System.config({
baseURL:“/node_模块”
});
System.defaultJSExtensions=true;
System.import('app/main.js')
.then(null,console.error.bind(console));