-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TS build output not invalidated when node_modules changed #38648
Comments
During an incremental rebuild, declaration files that aren't immediately included in the compilation process (i.e. those in A few options:
|
Got it. So sounds like ignoring the previous output directory (either by not restoring it or What are the other output/cache invalidation conditions when we should use So far it sounds like:
Anything else? Would have maybe thought "When TypeScript version changes" but looks like the output tsbuildinfo files contain the version number. |
I think that's it, unless you have other places where |
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow. |
Changes to types within node_modules do not invalidate the TypeScript build output.
Suppose we have a project with project references enabled and that there are no TypeScript errors in the project. If we update our node_modules to a new version of a package that contains types, that could introduce errors into our project. However, if we leave the build output directory in place, we do not see these errors in the
tsc -b
output.tsc -b
-- no errors.tsc -b
-- no errors, which is unexpected.Upon inspection of the tsbuildinfo files, the shas for the node_modules d.ts files do not get updated.
We cache our TS output directory between CI builds so that we can incrementally build from it on subsequent builds. We currently invalidate our cache whenever node_modules changes. Ideally, we could keep the cache and TypeScript could figure out what needs to be recompiled.
Separately, it would be great if the validity rules for the TypeScript output were documented as part of the project references docs. That would help us better understand when it is safe to rebuild from an existing output vs requiring a clean build (between TS versions, when node_modules change, etc).
Thank you! 😃
TypeScript Version: 4.0.0-dev.20200518
Search Terms:
project references, build, incremental, node_modules, invalidate, tsb,
tsc -b
, rebuild,@types
Code
https://github.com/brieb/ts-issue--tsb-nodemodules
Expected behavior:
TS errors reported when types within node_modules change.
Actual behavior:
No TS errors reported.
Errors only reported after editing code within project triggers invalidation.
Related Issues:
#25600
The text was updated successfully, but these errors were encountered: