question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incremental --build, then delete generated js file, then another incremental --build does not recreate js file

See original GitHub issue

TypeScript Version: 3.4.0-dev.20190326

Search Terms:

incremental

Code

tsconfig.json:

{
  "compilerOptions": {
    "incremental": true
  }
}

x.ts:

console.log("hello");

Expected behavior:

  • $ tsc --build
  • x.js has been generated
  • $ rm x.js
  • $ tsc --build

Expected: x.js has been regenerated

Actual behavior:

x.js still does not exist

Related Issues:

Did not find any.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:44
  • Comments:37 (6 by maintainers)

github_iconTop GitHub Comments

21reactions
irakliy81commented, Mar 31, 2019

A separate, but possibly related issue: deleting source .ts files does not remove the related .js files. Right now, to address this, I clean the output directory before every compilation - but this makes it impossible for me to use the --incremental flag.

13reactions
simonbuchancommented, Jul 19, 2019

Thanks for the clarification, @RyanCavanaugh. Here’s my thoughts:

Should --incremental assume that some files may have been deleted from disk?

In the general case, I’m fine with this, even if it breaks the cache transparency, I think. But it’s pretty common to delete the entire output directory, and it’s an unnecessary small cut to have to remember to delete the build cache too compared to other tools. Perhaps checking for just the output dir leads to false confidence?

Should a subsequent build delete files that were generated by a prior build but no longer have a source?

Scenarios where the enumerated set of files substantially matters

Substantially, perhaps, but the standard use case is the pack up everything in the out directory. For someone that’s not paying attention, this means they are bloating their package size.

as is deleting a source file in the first place.

Eh, depends on your style. moving source files is fairly common. The repo I’m in at the moment has 43 renames or deletes in the last 100 commits.

Incurring the cost of a clean or manual delete doesn’t seem like a very high burden compared to the amount of work and risk on our side to figure out what a “correct” delete is.

Not sure why there are scare quotes here: what’s wrong with lastBuildOutput.filter(f => !newBuildOutput.includes(f))?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to delete compiled JS files from previous typescript(.ts ...
The problem is when I, for example, rename the file boot.ts to bootstrap.ts and compile again, corresponding bootstrap.js file is created but the...
Read more >
A Complete Guide To Incremental Static Regeneration (ISR ...
Incremental Static Regeneration (ISR) is a new evolution of the Jamstack, allowing you to update static content instantly without needing a ...
Read more >
Improving the speed of incremental builds - Apple Developer
If compilation of a particular file takes significantly longer than other files, examine the file to see if header importation issues are causing...
Read more >
Incremental Static Regeneration - Data Fetching - Next.js
When a request is made to a page that was pre-rendered at build time, it will initially show the cached page. Any requests...
Read more >
Create a custom task - MSBuild - Microsoft Learn
The example also shows how to support incremental build, so that the code is generated only when the input files have changed. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found