Skip to content

node-pre-gyp still needed? #1891

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

Open
jimmywarting opened this issue Aug 30, 2021 · 4 comments
Open

node-pre-gyp still needed? #1891

jimmywarting opened this issue Aug 30, 2021 · 4 comments

Comments

@jimmywarting
Copy link
Contributor

jimmywarting commented Aug 30, 2021

if binaries are precompiled and downloaded, do we still need node-pre-gyp?
It seems to take up much of the total dependency: https://npmgraph.js.org/?q=canvas@2.8.0

maybe it can be optional somehow to install it?

@LinusU
Copy link
Collaborator

LinusU commented Aug 30, 2021

I was looking at this earlier for another package as well, it's crazy how big node-pre-gyp is when all it does for the end user is to download some binaries 😅

It also tries to require in aws-sdk and some other packages that aren't declared as dependencies which gives an error if you try to use webpack to bundle your code...

Would love some small package just for fetching the binaries! Maybe we should inquire about this upstream?

@Brooooooklyn
Copy link

Here is an alternative package without any postinstall scripts and dependencies: https://github.com/Brooooooklyn/canvas

@zbjornson
Copy link
Collaborator

zbjornson commented Jun 23, 2024

v3.0.0-rc switches to prebuild-install, which drops the prebuild-related dependency size from 2 MB to 948 KB. https://npmgraph.js.org/?q=canvas@3.0.0-rc2#select=exact%3Aprebuild-install%407.1.2

Right now the binaries are too large to include in the NPM tarball, but with quite a bit of work we might be able to get them small enough. (librsvg might make that difficult though.)

@chearon
Copy link
Collaborator

chearon commented Jun 24, 2024

The scope of SVG support is gigantic and impossible to do correctly, and I think people would be less sad if they actually avoided rendering SVGs at all. If we must have librsvg, we can support linking to librsvg in npm rebuild, but not ship it since it's so big. Or we could provide examples of how to use canvg in user-space. We'll need some SVG APIs for Path2D, so maybe we could use/contribute to resvg.

Yesterday I started work on redoing the entire font stack to fix long-standing font issues, which will reduce dependencies even more. With all that, I think we would be able to then ship in the NPM tarball.

I would like us to move to a static build to simplify CI/prebuild hell. Meson subprojects make doing that really easy, but sadly most of our dependencies haven't migrated to it yet. Maybe we'll have to add a vendor/ directory like Firefox and Chrome do.

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

5 participants