Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallelise typecheck and file emit using gulp-typescript #648

Open
skmehra opened this issue Apr 12, 2020 · 0 comments
Open

Parallelise typecheck and file emit using gulp-typescript #648

skmehra opened this issue Apr 12, 2020 · 0 comments

Comments

@skmehra
Copy link

skmehra commented Apr 12, 2020

Expected behavior:
I am trying to improve build performance of my project by concurrently triggering "tsc --noEmit" and "gulp" in parallel threads.
I would've expected gulp to skip type checking if I set isolatedModules to true and only emit js, dts files.
Actual behavior:
If isolated modules is set to true, declaration flag gets set to false in project setup. Due to this .d.ts files are not emitted.
Here's the code from project.js:
if (options.isolatedModules) {
options.newLine = typescript.NewLineKind.LineFeed;
options.sourceMap = false;
options.declaration = false;
options.inlineSourceMap = true;
}

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

var tsProject = ts.createProject("tsconfig.json", { declaration: true });
gulp.task("js", function() {
    return tsProject
        .src()
        .pipe(tsProject())
        .js.pipe(gulp.dest("dist"));
});

gulp.task("dts", () => {
    return tsProject
        .src()
        .pipe(tsProject())
        .dts.pipe(gulp.dest("dist"));
});
gulp.task("default", gulp.series("js", "dts"));

tsconfig.json

Include your tsconfig, if related to this issue.

{
"compileOnSave": true,
"compilerOptions": {
"moduleResolution": "Node",
"esModuleInterop": true,
"module": "commonjs",
"target": "es6",
"sourceMap": true,
"alwaysStrict": true,
"outDir": "./dist",
"rootDir": "./src",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"declaration": true,
"resolveJsonModule": true,
"isolatedModules": true,
"incremental": true,
"tsBuildInfoFile": "./.tsBuildInfoFile"
},
"include": ["./src/"],
"exclude": ["node_modules"]
}

Code

Include your TypeScript code, if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant