TypeStrong / grunt-ts

A grunt task to manage your complete typescript development to production workflow
https://www.npmjs.com/package/grunt-ts
MIT License
330 stars 121 forks source link

"Fast" compile does not work as cache is cleared on every compile #328

Open paullessing opened 8 years ago

paullessing commented 8 years ago

When I run grunt-ts in a setup with grunt-contrib-watch, the fast compile does not work. Every time a file is changed, I see the following message:

Cleared fast compile cache for target: app

I did some debugging and it appears the compile.js module is re-run every time, which clears the map which stores which files are cached for fast compile.

This results in a minor file change taking 45 seconds to recompile, which makes my entire grunt-ts setup rather pointless.

My setup is as follows:

nycdotnet commented 8 years ago

Hi, Thanks for the report. I'm slowly overhauling grunt-ts and haven't gotten to watch/fast yet. I appreciate you looking into the code. I'll be honest - the fast feature was written for a time before the TypeScript language service got good. If you're looking for incremental compilation, that's probably your best bet with today's TypeScript. The workflow would be compile on save with a good TypeScript editor like VS, VS Code, or Atom and then watch the emitted JS for the rest of your build tasks. Use grunt-ts as part of your full build target.

All that said, I'd like to make sure fast works if indeed it is bugged, so let's keep this open.

basarat commented 8 years ago

@nycdotnet feel free to remove the hacky fast code if it becomes a maintenance problem :rose:

basarat commented 8 years ago

Basically grunt-contrib-watch should be the one telling us which files changed. We had to get it to work because failure was not an option, but now the burden can really be pushed to grunt as this is something that should be generally supported by their ecosystem :rose:

nsgundy commented 8 years ago

Just wanted to chime in and say that I am really looking forward to having grunt-ts work with grunt-contrib-watch :) At the moment the only way to get it working seems to be to have fast turned off.

vapits commented 8 years ago

For me too. Fast fails with grunt-contrib-watch actually it cannot find modules if I work in a big project and not all the requires are in the file that is changed so the only option for me for now is to turn of the fast option.

wcdeich4 commented 3 years ago

I have the same problem - and I'm not even using fast compile

nycdotnet commented 3 years ago

Hi - at this point I highly recommend using the built-in TSC fast compile infrastructure. Grunt-ts is quite out of date and not maintained.