Gulp - Compile and Minify .ts files

849 Views Asked by At

I trying to write a task for Gulp for my "Task Runner Explore" in Visual Studio but get stacked. What I want is just to compile my .ts files, minify it and put inside "wwwroot/app" folder. I have this task:

var minify = require('gulp-minify');
var tsProject = ts.createProject('scripts/tsconfig.json');

gulp.task('ts', function (done) {

    var tsResult = gulp.src([
            "scripts/*.ts"
    ])
        .pipe(ts(tsProject), undefined, ts.reporter.fullReporter());

    return tsResult.js
        .pipe(minify())
        .pipe(gulp.dest('./wwwroot/app'));
});

but it show me errors:

at eval (eval at <anonymous> (C:\Users\Dantey\Documents\MY_project\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:2907:23)

I also tried with uglify() but error is the same.

0

There are 0 best solutions below