ivogabe / gulp-typescript

A TypeScript compiler for gulp with incremental compilation support.
MIT License
839 stars 129 forks source link

gulpjs recommends upgrading of vinyl for dependent plugins due to issues with gulp 4.0.0-alpha.3 #551

Closed dozer75 closed 6 years ago

dozer75 commented 6 years ago

Expected behavior: when using the latest version of gulp 4.0.0 alpha 3 typescript compilation should work.

Actual behavior:

In it's latest alpha gulp have upgraded the usage of vinyl to 2.0 or 2.1 (or in your case it seems that upgrading to vinyl-fs to ^3.0.0), somehow (I don't know why) this breaks building typescripts with gulp-typescript. See gulpjs/gulp#2065 for more information.

Your gulpfile:

Include your gulpfile, or only the related task (with ts.createProject).

var gulp = require("gulp");
var typescript = require("gulp-typescript");
var sourcemaps = require("gulp-sourcemaps");

var typescriptCompile = function (file, done) {
    const tsProject = typescript.createProject("tsconfig.json");

    if (file === null) {
        file = srcPaths.typescript + "**/*.ts";
    } else {
        console.log(`Compiling ${ file }`);
    }

    gulp.src(file)
        .pipe(sourcemaps.init())
        .pipe(tsProject())
        .js
        .pipe(sourcemaps.write(".", {
            includeContent: true, mapSources: function (sourcePath) {
                while (sourcePath.startsWith("../")) {
                    sourcePath = sourcePath.replace("../", "");
                }

                return `/${sourcePath}`;
            } }))
        .pipe(gulp.dest(destPaths.app))
        .on("end", done);
};

gulp.task("compile.typescript", function (done) {
    typescriptCompile(null, done);
});
ivogabe commented 6 years ago

Fixed in #550 and #552