You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--incremental with--build doesn't rebuild packages if when dependent package's .d.ts files changed in a workspace/monorepo setup. This repo demostrates the setup.
It has two packages a and b in a npm workspace (should repo with other workspace/monorepo setup).
Package a depends on b. When the type of the function export from b is changed, the incremental build in package a doesn't detect the change and rebuild (and error) when -b is used.
Go to packages/b/src/b.ts and change the return value from the number 3 to string "b"
npm run build at root again.
π Actual behavior
No error detect in the package a.
π Expected behavior
Error detected in the package a.
src/part1/a1.ts:3:7 - error TS2322: Type 'string' is not assignable to type 'number'.
3 const value: number = a2();
~~~~~
Found 1 error in src/part1/a1.ts:3
Additional information about the issue
npm run build:project in the repo will use -p to build instead of -b, and it has the expected behavior.
The text was updated successfully, but these errors were encountered:
This is working as intended. ``--build only cares about time stamps of your project files or any references in tsconfig. packages/a does not reference package/b so there is no way of knowing changes in b should also be accounted for. (--build` does not account for failed resolutions/ files already compiled as part of your projects etc)
I see. I guess the recommendation is to not use --build in this kind of set up, or specify cross package project references (which doesn't feel right)?
Two things play there: Not all projects will have tsbuildInfo .. its not mandatory if the project is not referenced. We have so far kept similar approach but have thought of doing extra in case of buildInfo but it involves checking modified time of more files and in repro where there are many projects with lots of d.ts files (that arent listed as files the project depends on explicitly) it adds up so this has been in backlog to experiment for a while and not guaranteed to change soon.
π Search Terms
incremental, monorepo, workspaces, rebuild
π Version & Regression Information
Repro since --incremental is introduced in 3.4
β― Playground Link
https://github.com/curtisman/repro
π» Code
--incremental
with--build
doesn't rebuild packages if when dependent package's.d.ts
files changed in a workspace/monorepo setup. This repo demostrates the setup.It has two packages
a
andb
in a npm workspace (should repo with other workspace/monorepo setup).Package
a
depends onb
. When the type of the function export fromb
is changed, the incremental build in packagea
doesn't detect the change and rebuild (and error) when-b
is used.Repro steps:
npm install
at rootnpm run build
at root3
to string"b"
npm run build
at root again.π Actual behavior
No error detect in the package
a
.π Expected behavior
Error detected in the package
a
.Additional information about the issue
npm run build:project
in the repo will use-p
to build instead of-b
, and it has the expected behavior.The text was updated successfully, but these errors were encountered: