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

Issue with tree-shaking in a project using Libauth #135

Open
paulmillr opened this issue Jun 10, 2024 · 7 comments
Open

Issue with tree-shaking in a project using Libauth #135

paulmillr opened this issue Jun 10, 2024 · 7 comments

Comments

@paulmillr
Copy link

The library bundles libsecp256k1 and a bunch of other libraries. When one includes 10 libraries in the repository, it's not zero deps.

It's misleading to call it "zero dependencies" in README and docs.

@bitjson
Copy link
Member

bitjson commented Jun 17, 2024

Libauth has 0 Dependencies

Screenshot 2024-06-17 at 10 09 42 AM

@bitjson bitjson closed this as completed Jun 17, 2024
@paulmillr
Copy link
Author

paulmillr commented Jun 17, 2024

The library is 4.32 megabytes. 4.32 mb of bundled libraries is not “ultra lightweight”

IMG_3143

@bitjson
Copy link
Member

bitjson commented Jun 19, 2024

@paulmillr are you having trouble with Libauth in a particular project? Could you share an example of how you're importing or bundling Libauth?

Libauth lightweight in that it is designed to be maximally "tree shaken" by all modern build tooling, so your built project will contain only the code necessary for your application.

For example, this demo using Libauth in Vite bundles all of its code, including a Libauth function it uses (dateToLocktime) into a single 1.87kb (gzipped) JS file. Libauth contributes only ~450 bytes to this bundle. In contrast, some JS libraries prevent efficient tree shaking, so applications using only a single function might be required to import the full code of that library.

@bitjson bitjson reopened this Jun 19, 2024
@bitjson bitjson changed the title Misleading docs: the library is not "zero deps" Issue with tree-shaking in a project using Libauth Jun 19, 2024
@paulmillr
Copy link
Author

This is not a tree shaking issue.

This is about misleading documentation. The library — all-in — is 4 megabytes. A similar "lightweight" library could be 500 kilobytes.

You're using tree-shaking? Cool. Most libraries are using tree-shaking nowadays. When all features of your library are used, it's still 4 megabytes - not 1.87kb gzipped.

The documentation can be adjusted.

@bitjson
Copy link
Member

bitjson commented Jun 20, 2024

I'm sorry that you're so frustrated with Libauth.

It seems like you've had trouble using the Libauth in a project, but I'm afraid I'm still misunderstanding the context for your issue.

Can you explain what sort of project you're building?

What did you expect the library to do, and what happened when you tried to use it?

Are you using npm? Did installing @bitauth/libauth add other dependencies? What features of Libauth are you using? Did using Libauth increase your application's bundle size more than you expected?

If you can provide a little more detail, I'd love to help you debug the issue.

@paulmillr
Copy link
Author

What did you expect the library to do, and what happened when you tried to use it?

I've expected the library to be "ultra-lightweight" and "zero-dependency" but in fact it's not. It bundles other libraries such as libsecp256k1 as WASM base64. If by "zero-dependency" you've meant it's "zero NPM dependencies" it should be clarified in README.

Did installing @bitauth/libauth add other dependencies

The result size of libauth is 1.7MB. The readme claims libauth is "An ultra-lightweight JavaScript library". 1.7 MB of code is not "ultra-lightweight".

Can you explain what sort of project you're building?

I'm building libauth.

@paulmillr
Copy link
Author

Single-file libauth that weights 1.7MB

libauth.js.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants