Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incremental Builds are not Reliable v5.4.5 #58427

Open
Jason3S opened this issue May 3, 2024 · 2 comments
Open

Incremental Builds are not Reliable v5.4.5 #58427

Jason3S opened this issue May 3, 2024 · 2 comments

Comments

@Jason3S
Copy link

Jason3S commented May 3, 2024

πŸ”Ž Search Terms

build, incremental, composit, tsbuildinfo, location, symlink

Related to: #48314
Maybe: #30946, #48981

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://github.com/Jason3S/tsbuild-issue

πŸ’» Code

Given the following code:

src/window.ts

import type vscode from 'vscode';

export const state: vscode.WindowState = {
    focused: true,
}

tsconfig.json

{
    "$schema": "https://json.schemastore.org/tsconfig",
    "extends": "@tsconfig/node18/tsconfig.json",
    "compilerOptions": {
        "incremental": true,
        "tsBuildInfoFile": "./dist/compile.tsbuildInfo",
        "declaration": true,
        "declarationMap": true,
        "module": "Node16",
        "moduleResolution": "Node16",
        "sourceMap": true,
        "outDir": "dist",
        // "types": ["node", "vscode"],
        "rootDir": "src"
    },
    "include": ["src"],
    "exclude": []
}

πŸ™ Actual behavior

image

After deleting the outDir (dist), it works as expected.

image

πŸ™‚ Expected behavior

For tsc -b . to re-build files when there are changes to dependencies.

Additional information about the issue

No response

@Jason3S Jason3S changed the title Incremental Builds are not Reliable Incremental Builds are not Reliable v5.4.5 May 3, 2024
@sheetalkamat
Copy link
Member

This is working as intended.

tsc --b does not check dependencies for upto date ness. It only checks at your root files, output and referenced project upto date ness

Here is output

c:\temp\tsbuild-issue>pnpm build

> [email protected] build C:\temp\tsbuild-issue
> tsc -b -v .

[1:33:47 PM] Projects in this build:
    * tsconfig.core.json
    * tsconfig.json

[1:33:47 PM] Project 'tsconfig.core.json' is out of date because output file 'dist/compile.tsbuildInfo' does not exist

[1:33:47 PM] Building project 'C:/temp/tsbuild-issue/tsconfig.core.json'...


c:\temp\tsbuild-issue>pnpm add -D @types/[email protected]
Packages: +1 -1
+-
Progress: resolved 3, reused 2, downloaded 1, added 1, done

devDependencies:
- @types/vscode 1.88.0
+ @types/vscode 1.89.0

Done in 1.4s

c:\temp\tsbuild-issue>pnpm build

> [email protected] build C:\temp\tsbuild-issue
> tsc -b -v .

[1:34:07 PM] Projects in this build:
    * tsconfig.core.json
    * tsconfig.json

[1:34:07 PM] Project 'tsconfig.core.json' is up to date because newest input 'src/window.ts' is older than output 'dist/compile.tsbuildInfo'

@Jason3S
Copy link
Author

Jason3S commented May 4, 2024

Ahhh, that explains why it doesn't work as expected. It only takes local dependencies into account. That is too bad. It means I have to do tsc -b . -f. I take it that there isn't a compiler option to have it check external dependencies.

By the way, thank you for the -v option. I was certain it meant --version and it does, but the meaning magically changes with the -b option. Only after realizing that you used it in a way I hadn't seen did I think to try tsc -b . --help. Looking further, I see that there is a --help --all option that shows everything. But I was surprised that the meaning of an option changes dramatically based upon other options.

I will open a feature request to add a compile option to "monitor external dependencies". I would rather have it take a little bit long to compile reliably than to waste time trying to figure out why something wasn't working only to realize I needed to do a clean build.

To be clear, I was sure this was a bug. I had opened the .tsbuildinfo file to see if it was tracking the external dependencies. It is. It just is not using them for composite or incremental builds. I'm guessing it is there for watch. Which then leads to the question why watch behavior would be different than tsc -b .. Which explains #48314.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants