Typescript编译排序问题
Typescript compile ordering issue gulp-typescript, tsc 1.6
我在Visual Studio 2015项目中使用gulp-typescript:"2.9.0"和typescript:" 1.6.2"将angular typescript文件文件夹编译成一个单独的app.js文件。我的问题是,连接的输出顺序是不正确的,导致角抛出异常。最初我能够改变文件名的字母顺序,我可以得到正确的顺序,但这只是停止工作。我还尝试在"_references"中以正确的顺序包含所有文件。它的文件,但这似乎不起作用。我包含了_references。它的文件,我在下面使用。文件"app.config"。它总是出现在输出的顶部,它取决于app.module。ts文件。有人能解决这个问题吗?
/// <reference path="../typings/angularjs/angular.d.ts" />
/// <reference path="../typings/jquery/jquery.d.ts" />
/// <reference path="../typings/angularjs/angular-route.d.ts" />
/// <reference path="app.module.ts" />
/// <reference path="app.zconfig.ts" />
/// <reference path="app/framework/framework.module.ts" />
/// <reference path="app/framework/psframework.directive.ts" />
/// <reference path="app/framework/menu/menu.module.ts" />
/// <reference path="app/framework/menu/menu.directive.ts" />
/// <reference path="app/framework/menu/menu-item.directive.ts" />
/// <reference path="app/framework/dashboard/dashboard.module.ts" />
我使用gulp-angular-filesort插件解决了这个问题。这是生成它的typescript编译任务:
gulp.task('compile', function () {
var pathsArray = paths.js.typescriptDefinitionFile.concat(paths.js.src);
gulp.src(pathsArray)
.pipe(typescript({
target: 'es5',
noImplicitAny: true,
preserveConstEnums: true
}))
.pipe(angularFilesort())
.pipe(concat(paths.js.srcOutputFile))
.pipe(gulp.dest(paths.js.outputFolder));
});
我没有在typescript配置对象中使用out选项来为每个.ts文件获取一个.js文件。然后,在使用angular sort插件之后,我将它们分别连接起来。
使用sortOutput参数-将其设置为true比如这里
var tscResult = srcResult
.pipe(gulpTypeScript({
typescript: require('typescript'),
sortOutput: true,
target: "ES5",
declarationFiles: true,
noEmitOnError: dontEmitTSbuildErrors,
out: "./obj/" + outFileName + ".js"
}, undefined, gulpTypeScript.reporter.longReporter()));
相关文章:
- 使用Handontable在同一列中用纯文本和html对问题进行排序
- 应用了转换时的D3js排序问题
- Ember组件'jQuery可排序的模板问题
- 循环的JavaScript排序问题
- 对数组进行排序时出现问题
- Javascript中的多维数组排序索引问题
- jQuery拖动到相对位置的可排序列表中时出现可拖动辅助对象位置问题
- 问题以在webkit浏览器中对数组进行排序
- 关于使用jQuery对Div中的内容进行重新排序的问题
- MongoDB排序&极限问题
- 排序 JSON 时遇到问题
- 动态填充表时突出显示和排序问题
- 角度 js 中的日期表列排序问题
- 数组中的类型出现问题,并尝试将内容排序到表中
- 启动表排序器时遇到问题
- 我的排序方法(AJAX,PHP&MySQL)出了什么问题
- Knockout JS + JQuery UI - 在重新排序后从可观察数组中删除项目的问题
- 具有排序问题的流体动态图像布局
- 按相关性能问题排序
- 在IE9-10中使用sort()问题排序DOM元素