I have this file, pasted from a tutorial (and let's face it, the disparity between docs, tuts, and examples is astounding):
/scripts/tsconfig.json:
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"noEmitOnError": true,
"noImplicitAny": false,
"outDir": "../wwwroot/appScripts/",
"removeComments": false,
"sourceMap": true,
"target": "es5",
"moduleResolution": "node"
},
"exclude": [
"node_modules",
"typings/index",
"typings/index.d.ts"
]
}
Options are set to compile on save, but whenever I save a TypeScript file, the JavaScript output ends up 'under', or 'attached to', the source file:
TypeScript
|
--test.ts
|
--test.js
, and that is physically in the same directory as the source, /TypeScript
. If tsconfig.json
is missing, the compiler complains, but when it's present, and it definitely is, the compiler ignores the "outDir": "../wwwroot/appScripts/"
setting.
I am really to new to Gulp, but the Gulp task looks OK to me:
var tsProject = ts.createProject('scripts/tsconfig.json');
gulp.task('ts', function (done) {
//var tsResult = tsProject.src()
var tsResult = gulp.src([
"scripts/*.ts"
])
.pipe(ts(tsProject), undefined, ts.reporter.fullReporter());
return tsResult.js.pipe(gulp.dest('./wwwroot/appScripts'));
});
ts
? Is it this gulp typescript module? npmjs.com/package/gulp-typescript – Staciestack