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

Export a proper public interface instead of a monolithic chunk #4339

Open
turt2live opened this issue Aug 6, 2024 · 2 comments
Open

Export a proper public interface instead of a monolithic chunk #4339

turt2live opened this issue Aug 6, 2024 · 2 comments
Labels
A-Developer-Experience T-Task Tasks for the team like planning

Comments

@turt2live
Copy link
Member

For cases where a consumer only needs a few functions instead of the entirety of matrix, like in matrix-org/matrix-react-sdk#12871 - they shouldn't have to consume 1mb of JS to do simple things.

This may change the project more towards a library than an SDK though, and warrants team discussion.

@robintown
Copy link
Member

@richvdh
Copy link
Member

richvdh commented Aug 7, 2024

Related: https://jaydenseric.com/blog/optimal-javascript-module-design

Interesting, thanks for the link.

I think that smaller JS modules - that only export one thing - can be a good idea for some packages (the article cites lodash, and it's right). But lots (most?) of the js-sdk just isn't designed to work that way -- it's not like you can meaningfully import Room without importing MatrixClient, and MatrixClient depends on Room, so there's nothing to be gained by doing so. Worse, if every file becomes part of the public interface of the js-sdk, it becomes hard to maintain without breaking backwards compat every release, and hard to use because you can't find the right interface.

So sure, +1 to smaller public interfaces that don't import the entire world, but we need to continue to be clear which modules are public and which are internal, rather than going back to open season on them.

@dbkr dbkr added T-Task Tasks for the team like planning and removed T-Enhancement labels Aug 7, 2024
@florianduros florianduros mentioned this issue Sep 25, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Developer-Experience T-Task Tasks for the team like planning
Projects
None yet
Development

No branches or pull requests

4 participants