Apologies for the silly question, I’ve got a no-code background so NPM packages are unfamiliar territory for me, but is this package allowed for our usage in WeWeb?
Sharp - GitHub - lovell/sharp: High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
It shows up in the search, but ChatGPT told me that this is a server-side package and would be incompatible with weWeb.
Aside from plugin conflicts, would that mean one should only download front-end related NPM packages or can it work for them all?
Besides my curiosity above, if the sharp npm package would work in WeWeb, what should I put under instance name?
If no, the alternative I was looking at was Jimp - GitHub - jimp-dev/jimp: An image processing library written entirely in JavaScript for Node, with zero external or native dependencies. , which I’m told is browser based. What should I put under the instance name for that?
You usually want to do this server-side indeed, it could get very slow very quickly
The search will surface all sorts of NPM packages - most of which are inappropriate for the front end or won’t work. You’ll want to test whether the package works, then whether it works for you. This requires a bit of discovery work. I made a video about this feature and how to get some juice from it:
More broadly, you can definitely do image manipulation work on the front end. It can involve more code. Here’s some recommended approaches for using JIMP in the browser with webworkers: jimp/packages/jimp/browser/README.md at main · jimp-dev/jimp · GitHub.
Running more complex operations on the front end means eating more code complexity, but it does have compensations in privacy, flexibility, and sometimes performance.
1 Like
Thanks Ray, I believe those first 10 minutes of your video itself deserves a mention on the NPM help article in WeWeb so that lots of users don’t make the mistake of downloading packages that aren’t suitable, and also help them quickly find out what NPM packages would be suitable in the first place.
That helps alot! Thank you
1 Like