digitalbazaar / jsonld.js

A JSON-LD Processor and API implementation in JavaScript
https://json-ld.org/
Other
1.66k stars 195 forks source link

Improving Network Performance with Treeshaking #419

Open ralphsaunders opened 3 years ago

ralphsaunders commented 3 years ago

Hi there,

I've recently looked to add a json-ld feature into an SDK I'm building that's sensitive to overall file size for network performance reasons.

When we measured the change in bundle output to our SDK we saw an increase of around ~40KB (Gzipped) from adding import { flatten } from 'jsonld' – inspecting the bundle showed we'd brought in seemingly most of the jsonld library and the similarly sized rdf-canonize library.

Would the maintainers of this project appreciate a hand in optimising their webpack configuration? There are probably some things that can be done to help web pack Treeshake this library better.

Cheers, Ralph