All modern library libraries support tree shaking feature in order to reduce bundle size. In case of @ory/client, it is not, (at least not fully) as it produces a runtime bundle of 2.3mb which contributes to longer loading times of my application.
Describe your ideal solution
Instead of one big file api.ts consisting of ~27k lines of code, it should be broken down into several smaller class files that embraces SOLID design principles. Few more optimizations that can be applied to a library to make it tree shakeable is explained in the below articles
Preflight checklist
Ory Network Project
No response
Describe your problem
All modern library libraries support tree shaking feature in order to reduce bundle size. In case of @ory/client, it is not, (at least not fully) as it produces a runtime bundle of 2.3mb which contributes to longer loading times of my application.
Describe your ideal solution
Instead of one big file api.ts consisting of ~27k lines of code, it should be broken down into several smaller class files that embraces SOLID design principles. Few more optimizations that can be applied to a library to make it tree shakeable is explained in the below articles
https://cube.dev/blog/how-to-build-tree-shakeable-javascript-libraries https://blog.theodo.com/2021/04/library-tree-shaking/
Workarounds or alternatives
no workarounds as we are forced to download entire @ory/client library even if we are consuming few classes, components or functions
Version
1.12.1
Additional Context
No response