microsoft/rushstack

[heft] Certain errors cause the watcher to stop updating, instead serving an outdated build

octogonz opened this issue · 1 comments

Summary

  1. Invoke heft start to work on a web app
  2. Save a change to a TypeScript file that produces an error
  3. Fix the error

Expected result: Pressing F5 in the web browser reloads the latest build

Actual result: Pressing F5 reloads the old build from step 1. Modifications of source files are entirely ignored.

This situation is extremely frustrating, because you can spend 10 minutes trying to understand why a bug persists no matter how you try to fix it, only to eventually realize that you're debugging an outdated build.

Repro steps

I haven't had time to prepare a step-by-step repro. But usually it is a simple syntax error such as renaming class TheThing { to class The Thing { in a *.tsx file. And the log output will look like this:

---- build started ----
[build:typescript] File change detected. Starting incremental compilation...
[build:typescript] Error: Debug Failure. False expression: File extension for signature expected to be dts: Got:: C:/Git/my-repo/apps/webapp/lib/ExamplePane.d.ts.map
-------------------- Failed (0.219s) --------------------
Encountered 1 error
  [build:typescript] Debug Failure. False expression: File extension for signature expected to be dts: Got:: C:/Git/my-repo/apps/webapp/lib/ExamplePane.d.ts.map
Waiting for changes. Press CTRL + C to exit...

In the above test, I was using a newer compiler:

[build:typescript] The TypeScript compiler version 5.2.2 is newer than the latest version that was tested with Heft (5.0); it may not work correctly.
[build:typescript] Using TypeScript version 5.2.2
[build:typescript] Starting compilation in watch mode...

However I seem to remember this problem occurring with TypeScript 4.x as well. (?) It's not a new phenomenon.

Details

@dmichon-msft believes it is actually a TypeScript compiler bug.

However even if that is the case, in such a situation either:

  • Heft should recover from the crash and automatically relaunch the compiler, - OR -
  • If recovery is impossible, Heft should at least notify the engineer as conspicuously as possible that the watch experience has broken

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@rushstack/heft version? 0.63.2
Operating system? Windows
Would you consider contributing a PR? Yes
Node.js version (node -v)? v16.20.2

🚀 This was fixed in @rushstack/heft-typescript-plugin 0.2.16