ivogabe / gulp-typescript

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

Cannot handle empty files array when project reference exists #606

Open Yesterday17 opened 5 years ago

Yesterday17 commented 5 years ago

Expected behavior: It should work as handbook says:

Note that starting with 3.0, it is no longer an error to have an empty files array if you have at least one reference in a tsconfig.json file.

Actual behavior: Error: Invalid glob argument:

Your gulpfile:

Full gulpfile.js here.

function compile(buildNls) {
  const tsProject = ts.createProject(`./tsconfig.json`);
  let r = tsProject
    .src()
    .pipe(sourcemaps.init())
    .pipe(tsProject())
    .js.pipe(buildNls ? nls.rewriteLocalizeCalls() : es.through())
    .pipe(
      buildNls
        ? nls.createAdditionalLanguageFiles(languages, "i18n", "out")
        : es.through()
    );

  if (inlineMap && inlineSource) {
    r = r.pipe(sourcemaps.write());
  } else {
    r = r.pipe(
      sourcemaps.write("../out", {
        // no inlined source
        includeContent: inlineSource,
        // Return relative source map root directories per file.
        sourceRoot: "../src"
      })
    );
  }

  return r.pipe(gulp.dest(outDest));
}

tsconfig.json https://github.com/Yesterday17/ZenScript/blob/master/tsconfig.json

{
  "files": [],
  "include": [],
  "references": [
    {
      "path": "./client"
    },
    {
      "path": "./server"
    }
  ]
}

Code Repository here: https://github.com/Yesterday17/ZenScript