Skip to content

Changes in .ts files are ignored on 2nd and next builds for indirect includes (--build)Β #49655

@michal-minich

Description

@michal-minich

Bug Report

πŸ”Ž Search Terms

I tried many searches but did not find this issue. Though this issue looks related #49527

πŸ•— Version & Regression Information

This behaviors occurs at least on 4.7.4 and 4.8.0-beta.

⏯ Playground Link

I was not able to setup Bug Workbench playground because I was not able to make it work with @files switch, even if it is documented it should work.

πŸ’» Code

// @filename: index.ts
import  { pi } from "./utils";
console.log(pi);

// @filename: utils.ts
export const pi = 3.14;

// @filename: tsconfig.json
{
  "files": ["index.ts"],
  "compilerOptions": { "outDir": "./out" }
}

πŸ™ Actual behavior

  1. Invoke compiler with tsc --build, it builds successfully, producing index.ts and utils.ts, and skips files which are not imported, if any.
  2. Change the value of the pi constant or make syntactic error in utils.ts file.
  3. Invoke compiler again with the same command.
  4. The compiler finishes without error (if there is one), also .js files are not updated.

πŸ™‚ Expected behavior

  • I expect the compiler to emit an error in step 4, if there is one, and also emit .js file.
  • If this is invalid configuration, which I hope it isn't, then I would expect it will fail on first build.

There is another scenario which behave the same way. When instead of files the included options is used, but pointing only to folder where index.ts files is. The utils.ts has to be in different folder.


Originally I started investigating regression in 4.8.0-beta on existing project which uses incremental build and only one "index" file in the files tsconfig option. There the first build passes OK, but after I change code or make error in a file, the build finishes without doing any work (reporting error or emitting code). Also the 2nd and all next builds are very quick - less than 1s. Where for 4.7.4 it took several seconds. Yet in the case of the full project the 4.7.4 (and many previous versions) behaves as expected, which is not in case of this simplified code. So there might be more special cases of this issue.

Metadata

Metadata

Assignees

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

Issue actions