Open michaelaird opened 5 years ago
NB: unfortunately, setting "incremental", either in tsconfig.json or in the call to gulp-typescript, doesn't work.
This may need to wait for typescript to provide an API https://github.com/Microsoft/TypeScript/issues/29978
If you want to use typescript 3.4 with gulp-typescript on composite builds, then you can trick typescript into not tripping up by explicitly setting tsBuildInfoFile:
"tsBuildInfoFile": "./buildcache/tsBuildInfo",
I needed to find a way for us as we'd like to keep in step on language features and we can now use incremental in our dev build.
If you want to use typescript 3.4 with gulp-typescript on composite builds, then you can trick typescript into not tripping up by explicitly setting tsBuildInfoFile:
"tsBuildInfoFile": "./buildcache/tsBuildInfo",
I needed to find a way for us as we'd like to keep in step on language features and we can now use incremental in our dev build.
Unfotunately this didn't work for us. There is still no ".tsBuildInfo"
@mzyil
You won't be able to get that until this issue is resolve which depends on API support.
We're using tsc --build for our developer build and then gulp-typescript for our production bundle.
The Typescript issue is now closed: https://github.com/microsoft/TypeScript/issues/29978 Any plans to work on this?
Having support for the --incremental flag would be great.
Great news that TypeScript now exposes this in an API. I personally won't have time to work on this in the following weeks. If someone wants to work on this, let me know and I'd be happy to give some guidance.
I'm not that familiar with the tsc --build
option. For incremental compilation, it seems like we must use createIncrementalProgram
instead of createProgram
. For the first compilation we need to pass that function the build information from the .buildinfo
file which we get using readBuilderProgram
. For further incremental compilations, we just need to pass it the old Program just like we're already doing.
I took a first crack at emitting .buildinfo files (https://github.com/ivogabe/gulp-typescript/pull/618) . This might be enough?
@michaelaird does your PR enable the incremental builds only if the option in tsconfig.json
is set?
"tsBuildInfoFile": "./buildcache/tsBuildInfo",
or do we need to change something else in the stream?
If the .buildinfo file is created by tsc ( because the composite option or incremental option is true) the buildinfo file will be available on result.buildInfo.
It’s possible we might want to always emit this alongside the js and not need another stream.
On Sun, Jun 16, 2019 at 11:09 AM Melih Yıldız notifications@github.com wrote:
@michaelaird https://github.com/michaelaird does your PR enable the incremental builds only if the option in tsconfig.json is set?
"tsBuildInfoFile": "./buildcache/tsBuildInfo",
or do we need to change something else in the stream?
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/ivogabe/gulp-typescript/issues/611?email_source=notifications&email_token=AABVP2OBYS5FL3UBE4QCLSDP2ZJTLA5CNFSM4G7CYPL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXZPBYQ#issuecomment-502460642, or mute the thread https://github.com/notifications/unsubscribe-auth/AABVP2PURJ2QINICUIXN7TTP2ZJTLANCNFSM4G7CYPLQ .
Any workaround available? It takes like 5 seconds to build all my scripts, and it takes milliseconds when in incremental mode.
It's entirely possible that my changes targeting 3.4/3.5 are entirely useless with 3.6 and the correct approach is to tie into the the new apis to support incremental builds (https://github.com/microsoft/TypeScript/issues/31849) , ie createIncrementalCompilerHost and createIncrementalProgram.
That’s a good point, I’ll try to make some time for it this weekend
any updates on this?
There were some issues with the tests, after upgrading TypeScript. I don’t get them locally, so it may be OS related.
The tsbuildinfo file can currently crash the compiler, so I was preparing a temporary fix which would just ignore the tsbuildinfo file, and then later implement the new incremental apis. I’ll continue with it in this weekend
@ivogabe Thank you! Please let me know if i can help.
Any updates on this?
Work-in-progress PR in #635. Some functionalities of the new API are not clear to me yet, I hope to get more information on that soon.
Typescript 3.4 introduces emitting .tsbuildinfo files that are used for --incremental builds outside of --watch: https://devblogs.microsoft.com/typescript/announcing-typescript-3-4-rc/
gulp-typescript should emit the appropriate .tsbuildinfo files.