stdlib
stdlib copied to clipboard
npm package too big for jsDelivr
I'm trying to load this package from jsDelivr CDN but it fails because the package is over 100 MB. Are there any files that could be removed to reduce the package size?
Probably related to https://github.com/stdlib-js/stdlib/issues/373
A local installation also is hundreds of MBs.
Thanks for reaching out! Indeed, the project is currently not as easily consumable as it should be. One of our next steps is to finish the tooling to publish individual namespace packages to npm (e.g., all of @stdlib/assert
or all of @stdlib/random
). Will keep you posted.
However, we do have distributable UMD bundles of the project that you might want to look at. They are also available via the jsDelivr CDN:
https://github.com/stdlib-js/stdlib/tree/develop/dist#usage
@domoritz Beside using one of the UMD bundles, you can also do one of the following:
-
If your target environment supports ESM, you could consider our experimental ESM build.
-
Install locally, vendor, and host.
-
Use project tooling, similar to how we do here, to create your own UMD bundle.
Would any of the above possibly work?
Awesome to hear that improvements are in the works.
I wanted to play with stdlib in observable and was hoping to have a simple import of the library. I saw https://observablehq.com/@kgryte/stdlib?collection=@kgryte/stdlib uses a specific import from https://unpkg.com/@stdlib/[email protected]/dist/stdlib-flat.min.js
but it would be nice to use the standard require
or import
syntax from Observable.
The ESM bundle doesn't seem to work on Observable yet, btw.
@domoritz Here is an example of loading individual ESM modules into Observable.
🙌 thanks for the link. stdlib = require('@stdlib/dist-tree')
is perfect for experimenting and the esm imports for individual packages are perfect once you know what you need.
Awesome. Let us know if we can be of any further help. :)
Update: individual packages are now consumable. While the individual packages do not expose UMD bundles atm, one can locally install and then bundle for use in web applications.
Every standalone package currently contains UMD bundles, along with instructions as to how to use in, e.g., Observable.
@Planeshifter Is there anything more we can do here?
Posting a final update here. I've updated an Observable notebook, which demonstrates how to perform benchmarks, to use standalone package UMD bundles.
I've further created a test notebook, which attempts to load the various UMD bundles across (almost) all standalone repositories. Note that this notebook takes several minutes to run. In short, all UMD bundles for those packages which are browser-compatible are able to be loaded into Observable via jsDelivr.
Accordingly, I will go ahead and close this issue. If further issues arise, we can revisit by either reopening this issue or opening a new issue.