Open czdietrich opened 2 years ago
Is there any update on this? This is killing productivity. We have typescript complication on a project that has some long running AOT and this causes every build during the development to rebuild this expensive project. Thanks.
Would be nice, if this is getting fixed. The patch is trivial.
Since there was no activity on this issue we fixed it on ourselves by creating a copy of this NuGet using a stable string hashing.
Any chance we can just patch this issue? This is an extreme productivity stopper and just costs time and money. The fix is simple, so please let us invest these hand full of minutes and fix this in the official NuGet.
Please release a fix for this.
Removed mine and assigned myself to look into this
@joj gentle ping, also would you know where is the source code for this? I could not find it anywhere.
Thanks for the ping, this got lost in the noise for some reason. I'm creating an internal item to track it to make sure that we look into it. Sorry for that!
On the source code, the typescript nuget code was never open sourced (like the rest of typescript). I can make the change, though.
@joj re:
On the source code, the typescript nuget code was never open sourced (like the rest of typescript). I can make the change, though.
This would be super gentle and mightily useful to have this open source! IMHO, this would have made this issue mostly a non-issue as it could have been fixed with a PR a while back :)
Yeah, I see your point. Making something open source is a very intentional decision, though, and at some point we decided the nuget didn't meet the bar. I'll try to get that change soonish... I was researching and the solution to the hash code problem people are coming up with I'm not convinced about. I'll try something better (more standard).
Hi, is there any progress on this issue?
I fixed this today, should be on next release :D
Is there a prerelease NuGet which we can test?
There was a 5.3.0 beta release for that NuGet, recently. We tested it on our side and can confirm that it now works as expected. Thank you, the issue is now solved from my point of view, so we could close the ticket.
I have tested rebuilding with Microsoft.TypeScript.MSBuild
5.6.2 and it still unnecessarily runs the PreComputeCompileTypeScriptWithTSConfig
step. 5.3.2 also has the same behavior:
We see the same thing, would be good to know if the PreComputeCompileTypeScriptWithTSConfig
is required even when no .ts
changes have been made. To date I've assumed this process is checking whether the files have changed and the TS compiler needs to run or not, as implied by the method definition:
First, this target associates each tsconfig file with its associated output log file. Then it uses VsTsc to determine the input and output files of the triggered computation. These files are used to decide whether or not to skip CompileTypeScriptWithTSConfig.
Worth noting however that this process does take ~1 second on my machine.
PreCompute is a pre-process we run to check if we actually need to run the full thing. It runs always, and should be super fast.
In my rebuild, it is the #1 most expensive task, and I only have a single typescript file in the entire solution.
Building a project that uses
Microsoft.TypeScript.MSBuild
NuGet using e.g.dotnet build
will compile typescript files each run even though there were no changes.NuGet version: 4.8.2
Details
The target
PreComputeCompileTypeScriptWithTSConfig
will run before the actual typescript compilation and use theGenerateOutputLogs
task to check whether there is already a valid cache file in the obj folder in the form ofTsc<NUMBERS>.out
. Unfortunately this<NUMBERS>
block is generated by using thestring.GetHashCode()
method on the file path of the passedtsconfig.json
file. This hash code function is not stable in .NET (Core) and will be different for each new process, see also Remarks in the documentation. That's why the normal hash code of astring
cannot be used to persist data.Proposed Fix
There was a similar issue for the incremental build in the WPF repo. The fix was just to replace the hash code generation with a stable version. See also this PR.
I could not find the code of the Microsoft.TypeScript.MSBuild NuGet in this repo else I had also made a PR containing the fix.