-
Notifications
You must be signed in to change notification settings - Fork 109
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
Reduce library size #96
Comments
Love the work you've done to look into this, a sincere thank you.
However, you're absolutely correct that I've got an extremely busy week ahead of me, but will do my best to loop back next weekend to make this change Otherwise, we always love and accept pull requests 👀 |
I noted another thing behind That's why Probably |
Here's some additional research on how jimp could be configured to reduce the size: The
The only special plugin that node-vibrant seems to use is the The import configure from '@jimp/custom';
import types from '@jimp/types'; // all of jimp's default types
import resize from '@jimp/plugin-resize'; // resize function
const Jimp = configure({
types: [types],
plugins: [resize]
}); |
Seems like I might need to write some typings, but massive thank you @NotWoods. I'll try to finish this this week |
Typings are taking longer than I thought originally. I know I'm going the long way around, but I want to make sure I'm fixing up the ecosystem as well as our own needs |
The typings for jimp ended up taking a bit, but it's a good contribution upstream: After this is merged in, I'll make the optimization to |
With the release of Jimp 0.8.4, this can now be done! I'll have a PR open tonight with it! :D |
Waiting on jimp-dev/jimp#815 in order to fix some issues after |
Co-authored-by: Eryk Rakowski <[email protected]> Fixes #108, replaces #102, closes #96
This has been solved as-of the |
I see this library declares
jimp
as a dependency for doing some transformations.I'm analyzing my projects dependencies (I have
node-vibrant
in mypackage.json
and looks likejimp
need a lot of spaces:The point is,
jimp
includes some plugin by default:but not sure if all the plugins are relevant for
node-vibrant
.I want to suggest two approaches:
Consider use
sharp
(my favorite solution)
As you can see in my bundle, I have also
sharp
as a dependency.The main difference between both is
jimp
is 100% javascript code, whilesharp
delegate into son binaries.At the first time I thought
jimp
could be better since it doesn't have dependencies, but the reality is so different:sharp
ship pre-installed binaries and the package size is actually tooo much smaller thanjimp
.In fact,
sharp
perf is superior, seehttp://sharp.pixelplumbing.com/en/stable/performance/
Just exclude non necessary
jimp
I suppose that inside 185MB that
jimp
is adding there, just a few things are actually used.Not sure how to do that from a
node-vibrant
, but for example adding a tiny section on README.md explicitly listed the necessaryjimp
plugins should be enough for anyone exclude the rest of non necessary things into a pre-build stepThe text was updated successfully, but these errors were encountered: