Skip to content

Incremental Builds are not Reliable v5.4.5 #58427

Not planned
@Jason3S

Description

@Jason3S

πŸ”Ž 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

  • pnpm add -D @types/vscode@1.88.0
  • pnpm tsc -b .
  • Builds as expected.
  • pnpm add -D @types/vscode@1.89.0
  • pnpm tsc -b . <-- Should NOT Build, but it does.
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

Activity

changed the title [-]Incremental Builds are not Reliable[/-] [+]Incremental Builds are not Reliable v5.4.5[/+] on May 3, 2024
sheetalkamat

sheetalkamat commented on May 3, 2024

@sheetalkamat
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

> tsbuild-issue@1.0.0 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/vscode@1.89.0
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

> tsbuild-issue@1.0.0 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

Jason3S commented on May 4, 2024

@Jason3S
Author

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.

typescript-bot

typescript-bot commented on Jun 17, 2024

@typescript-bot
Collaborator

This issue has been marked as "Working as Intended" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Jason3S@RyanCavanaugh@sheetalkamat@typescript-bot

        Issue actions

          Incremental Builds are not Reliable v5.4.5 Β· Issue #58427 Β· microsoft/TypeScript