【发布时间】:2016-05-16 12:31:09
【问题描述】:
我已经完成了angular2 tour of heroes。我想知道如果我想为生产构建这个项目怎么办。我只想将 2 个文件添加到 index.html:appScripts.js 和 vendorScripts.js。
我已经用选项outFile 编译了我的ts 文件,所以我有我的appScripts.js 但它不起作用。这是我的 gulpfile 中的一些代码:
gulp.task('compile', ['clean'], function() {
var tsProject = typescript.createProject('tsconfig.json', {
outFile: 'app.js'
});
var tsResult = gulp.src(['app/**/*.ts'])
.pipe(typescript(tsProject));
return tsResult.js
.pipe(gulp.dest('./dist'));
});
我认为这是因为,我们在项目 ts 文件中加载了一些像 @angular/core 这样的角度模型,并且因为一些 systemjs 的东西..
有什么解决办法吗?
【问题讨论】:
-
也在研究这个,网上不多。如果你能找到什么,请分享。英雄之旅教程应用程序总共下载了数百个 2.2 Mb 的文件。必须有一种方法来减少 prod 部署。
标签: javascript angularjs angular gulp systemjs