typescript output order - gulp equivalent to tsc with tsconfig.json -


given tsconfig file , using command-line tsc, working should. however, using gulp-typescript tsconfig.json , outfile specified creates different output ordering - problem can't find gulp way generate same javascript tsc does.

our build workflow based on gulp; tsc gold-standard, has nice watch feature, , has broad tooling support (eg http://dev.ivogabe.com/using-vscode-with-gulp-typescript/). great if make our gulp-based build work same tsc.

example tsconfig.json:

{   "compileroptions": {     "declaration": false,     "preserveconstenums": true,     "outfile": "out/out.js",     "sourcemap": true,     "target": "es5",     "noemitonerror": true   },   "exclude": [     "node_modules",     "out"   ] } 

example gulpfile.js:

"use strict"; var gulp = require('gulp'); var typescript = require('gulp-typescript');  var tsproject = typescript.createproject('tsconfig.json');  gulp.task('typescript:compile', function () {     var tsresult = tsproject.src()         .pipe(typescript(tsproject));      return tsresult.js.pipe(gulp.dest('out')); }); gulp.task('default', ['typescript:compile']); 

again, problem tsc above tsconfig.json; , gulp above gulpfile.js , tsconfig.json (using gulp-typescript) produce different output ordering non-trivial directory of typescript files. developers should able switch between 2 build processes arbitrarily , remain confident didn't miss output ordering bug.

i don't understand difference between output ordering rules used tsc , gulp-typescript, haven't been able create simple repro case problem. ideally gulp-typescript when using tsconfig project use same ordering tsc.

i can solve using "child-process".exec call tsc, gulp-typescript has better gulp integration; i'm open using other gulp plugins call typescript compiler directly (and use tsconfig.json project file), haven't been able find one.

my problem can't find gulp way generate same javascript tsc does

typescript has internal implementation of ordering by:

  • order of files passed in command line. if tsconfig not relevant.
  • order in files detected. since using tsconfig start @ first file , order others references , import directives.

note: not available api consumers (like gulp). can lead issues tsc : https://github.com/typestrong/atom-typescript/blob/master/docs/out.md

so use external modules : https://basarat.gitbooks.io/typescript/content/docs/project/modules.html

and here quickstart : https://basarat.gitbooks.io/typescript/content/docs/quick/browser.html


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -