gulp-community / gulp-cached

A simple in-memory file cache for gulp
MIT License
452 stars 23 forks source link

gulp-cached and gulp-typescript compatibility #25

Open mporam opened 4 years ago

mporam commented 4 years ago

Not sure if this is the right place to log this or not. Sorry if it is not.

Currently gulp-cached and gulp-typescript cannot work together if you are using global variables or functions. While obviously that is not ideal in a JS project, it is the reality of many legacy applications.

I am currently converting a JS proj to TS. It has ~35 JS files which are included into their respective html files as needed. I have converted each js file into .ts and have it compiling them into .js using gulp-typescript. However the watcher takes ~11s to run due to the size and amount of files. gulp-cached is the ideal fix for this. However.

When gulp-cached filters out the unchanged files from the file list and passes the changed files onto gulp-typescript, gulp-typescript then errors because the global functions/variables don't exist within the set of files currently being compiled.

There needs to be a way that gulp-typescript can access the cache of files to ensure the currently being compiled files dont error when combined with the cached files (excluding the file being compiled).

Hope this makes sense.