directus/directus

Packages using memory even if they are not used

Open

#24,334 opened on 2025年1月7日

GitHub で見る
 (3 comments) (0 reactions) (0 assignees)TypeScript (3,505 forks)batch import
EngineHelp WantedOptimizationPerformance

Repository metrics

Stars
 (25,193 stars)
PR merge metrics
 (平均マージ 10d 11h) (30d で 99 merged PRs)

説明

Describe the Improvement

While investigating https://github.com/directus/directus/issues/24035 I found multiple packages being loaded into memory even if they were not being in use. The most impactful package was node-xmllint from @authenio/samlify-node-xmllint even though I was not using SAML. But others like openid-client or ldapjs were being loaded as well, but my configuration was not using OpenId or LDAP.

To reduce the memory usage, we could lazy load these and all other packages that are not required if respective configuration is not active. For example, lazy load @tus/server and only import it if TUS_ENABLED is set to true

コントリビューターガイド