Closed monarchwadia closed 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:
minify
setting from false
to true
in the esbuild
configuration within the build.mjs
file, we reduced the build size significantly — from about 240kb to approximately 85kb. However, it's important to note that enabling minification can sometimes lead to harder debugging and slightly longer build times due to the compression process.core
and streaming
modules of the openai
package are the largest contributors to the size. Regarding issue #4:
Getting the build size down to under 30kb could be challenging without compromising some functionality or finding alternative, lighter libraries.
Great find @CoderDill ! Would you be interested in creating a PR for this?
@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 !
On NPM, build size shows 2.48 mb
Figure out why this is & slim it down to under 30kb or less if possible