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

Don't package unnecessary files in npm pack #155

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

elliot-nelson
Copy link
Contributor

SUMMARY

I noticed that the bundle size for bottleneck is larger than I'd expect, since (by default) it is packing everything. I took a stab at limiting this only to files that are necessary.

DETAILS

  • Pack lib/*, along with *.(js|ejs|ts). You might be able to restrict this even further, but at least this keeps the src and test folders out of the distributed package, which is the main goal.

@jtnix
Copy link

jtnix commented May 23, 2020

I tried your build in my recent CRA project but saw no difference in bundle size vs. 2.19.5 current according to source-map-explorer, bottleneck is still 48k for me:
bottleneck bundle size
I also don't understand why there appears to be 15k in redis support libraries when I am not using redis. Am I missing something?

@elliot-nelson
Copy link
Contributor Author

Ah, thanks for testing it out!

The change I'm suggesting will only lower the cost of the npm published package (for example, a server app that uses bottleneck as a dependency). It won't affect the size of the pre-bundled .js files that would be used in a browser app.

(As far as the redis files go, there are several .js files generated - like light.js - one of those alternate bundles might be available that would not contain the redis utils.)

@jtnix
Copy link

jtnix commented May 25, 2020

Ahh, I was wondering if I was seeing all that because I am using bottleneck in a client app. I just need something to prevent client from queuing more than 4 API calls per second to an API, maybe there is something else I should try? I will check out the light.js option, though.

@devvaneio
Copy link

Up

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

Successfully merging this pull request may close these issues.

3 participants