TypeStrong / TypeStrong/ts-loader

Incremental builds not working

Open
#1,502 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.5k
Forks
439
Avg merge
17h 17m
Merged PRs (30d)
2

Description

Expected Behaviour

When tsconfig has the incremental compiler option set to true, a '.tsbuildinfo' file should be produced alongside the built *.js files in order to enable tsc to perform incremental builds.

Actual Behaviour

Not only is no '.tsbuildinfo' file produced, but no TypeScript build artifacts at all are produced. The outDir in tsconfig appears to be entirely ignored. The only output is the Webpack bundle, as specified by output.path.

Additionally, even if no changes have been made to any files, the compilation process still takes >15 seconds.

If I run tsc directly, the outDir (including .tsbuildinfo) is produced as expected.

Where does the output of tsc go? Clearly it's somewhere, because Webpack is able to read it to produce the bundle. But it doesn't seem to be persisted between builds.

Steps to Reproduce the Problem
  1. Set outDir to "./build/" in tsconfig.json.
  2. Set incremental to true in tsconfig.json.
  3. Set output.path to path.resolve(__dirname, "dist") in webpack.config.js.
  4. Run webpack. Observe that no .tsbuildinfo file is produced.
Location of a Minimal Repository that Demonstrates the Issue.

https://github.com/JoshuaWalsh/webpack-incremental-reprex

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the referenced minimal repository, using tsconfig.json with incremental and outDir alongside webpack.config.js with output.path, then inspect how ts-loader passes TypeScript output to Webpack. Done means webpack produces the expected JavaScript files and persists .tsbuildinfo so unchanged builds can use incremental compilation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, webpack
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.