-
Notifications
You must be signed in to change notification settings - Fork 757
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
Better exports #1241
Comments
Hi @wighawag , can I be assigned this please? |
hello @wighawag The benefit of doing this are:
|
@wighawag can I be assigned this task? I'll deliver as soon as possible To tackle this task, I’d start by updating the package.json to configure exports for modular access. This involves restructuring the exports field so that individual utility functions, like those in utils and specifically num, are accessible as separate entry points. This setup will allow for better dead code elimination by letting users import only the utilities they need, such as toBigInt from starknet/utils/num, which reduces bundle size and improves performance. After setting up the exports, I’d test the changes by importing functions selectively in a test environment to confirm that only the required code is included in the output bundle. Additionally, I’d verify that type declarations are correctly accessible to ensure a seamless developer experience. |
Is your feature request related to a problem? Please describe.
Currently starknet.js export many of its utilities as object, which prevent best dead code elimination
Describe the solution you'd like
It would be better to expose the utils via package.json
exports
fieldso if you were to export num utils this way in your package.json:
we would then be able to import it this way and benefit from dead code elimination if we were to only use part of the num exports:
Also another bonus is that it will let us access types defined there too
The text was updated successfully, but these errors were encountered: