monarchwadia / ragged

33 stars 4 forks source link

Reduce build size #3

Closed monarchwadia closed 4 months ago

monarchwadia commented 5 months ago

On NPM, build size shows 2.48 mb

Figure out why this is & slim it down to under 30kb or less if possible

CoderDill commented 4 months ago

I've been exploring the build size issue related to the Ragged project, and here's what I've discovered:

The bulk of the build size is due to the openai package, which includes numerous internal dependencies and substantial code. A detailed examination using the source-map-explorer tool revealed that components such as core and streaming within the openai package are the primary contributors to the size.

Here's what I found:

Regarding issue #4:

Getting the build size down to under 30kb could be challenging without compromising some functionality or finding alternative, lighter libraries.

monarchwadia commented 4 months ago

Great find @CoderDill ! Would you be interested in creating a PR for this?

monarchwadia commented 4 months ago

@CoderDill 's addition reduced the size to 70kb. I've also removed openai and rxjs as dependencies in build.mjs.... altogether, the main build size is <8kb now, and npm will report 21kb probably because of the accompanying d.ts files

Thanks again @CoderDill !