Skip to content
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

fix(js): invalidate tsconfig files cache in the @nx/js/typescript plugin when extended files change #30071

Merged
merged 2 commits into from
Feb 18, 2025

Conversation

leosvelperez
Copy link
Member

@leosvelperez leosvelperez commented Feb 17, 2025

Current Behavior

  • The persistent tsconfig files cache used by the @nx/js/typescript plugin does not get invalidated when the tsconfig files it extends from are updated.
  • Absolute paths are stored in the cache, which would be incorrect when distributing the cache.
  • The plugin throws a cryptic error when the lock file doesn't exist.

Expected Behavior

  • The persistent tsconfig files cache used by the @nx/js/typescript plugin should get invalidated when the tsconfig files it extends from are updated.
  • Paths should be stored relative to the workspace root.
  • The plugin should handle when the lock file is missing.

Additionally, a few other performance improvements were made to offset the overhead introduced by creating a stricter cache key:

  • cache and reuse file reads between tsconfig reads and file hashing (now each file is only read once, if read at all)
  • initialize a pre-populate tsconfig files cache in a first pass to skip checking cache entries' key in subsequent reads
  • reduce the tsconfig file cached content we store to disk
  • cache the check for external project references

Related Issue(s)

Fixes #29429

@leosvelperez leosvelperez self-assigned this Feb 17, 2025
@leosvelperez leosvelperez requested a review from a team as a code owner February 17, 2025 15:11
Copy link

vercel bot commented Feb 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Feb 18, 2025 10:25am

Copy link

nx-cloud bot commented Feb 17, 2025

View your CI Pipeline Execution ↗ for commit 6d9ad6b.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 36m 6s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 16s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check --base= --he... ✅ Succeeded 7s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 5s View ↗
nx documentation ✅ Succeeded 1m 51s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-18 11:05:06 UTC

@leosvelperez leosvelperez force-pushed the js/fix-plugin-tsconfig-caching branch from c5cd92b to 2cbd2cf Compare February 18, 2025 09:47
@leosvelperez leosvelperez force-pushed the js/fix-plugin-tsconfig-caching branch from 2cbd2cf to 6d9ad6b Compare February 18, 2025 10:22
@leosvelperez leosvelperez merged commit 96c775b into master Feb 18, 2025
12 checks passed
@leosvelperez leosvelperez deleted the js/fix-plugin-tsconfig-caching branch February 18, 2025 11:35
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed to convert JavaScript value Null into rust type String
2 participants