mapbox/node-or-tools

Size too large for deployment. Possibilities to reduce size?

Opened this issue · 1 comments

Hey, guys. Thanks for making a great library. I'm getting beautifully optimized routes!

My issue revolves around the resulting library size. Pulling from npm, this library comes in at a chunk of 475 MB, and it looks like the biggest piece is libtools.a @ 317 MB.

Is there any way I can reduce this size? We were really hoping to use this in a Lambda function to build optimal routes for our fleet, but the Lambda max is 250 MB. Is there another version of libtools.a or node-or-tools in general that's a bit slimmer?

Thanks a lot for any help!

Edit: Using --build-from-source doesn't work either if it helps.

Update to this:

I ended up removing the mason_packages folder in post install. It greatly reduced the size down to about 25 MB and still seems to function just fine. I'm sure I'm missing a binary or something somewhere that's available at the lower size, but this is currently working.

Edit: I'm not closing mainly because my solution is a workaround, and I believe a better one is possible. 😄