Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request optimizes the bundle size of the packages significantly.
Originally, the sizes of the components were around 120KB and 124KB. By updating the
tsconfig
to externalizereact
andreact-dom
dependencies and enabling the treeshaking option in the config, the size of the packages was reduced to around 25KB-28KB, and the core package from 166KB to 57KB—a significant reduction of about 75%. Additionally, I added a new script in thepackage.json
files of the packages to remove unnecessary.d.cts
files when the packages are built..d.cts Files
These files were generated because the
tsupConfig
declared the CJS format, causing the.d.cts
files to be created. However, these files are not required since the original format of the packages/components is ESM modules, which generate the.d.ts
files supporting both ESM and CommonJS modules. Therefore, the creation of these files is unnecessary unless the user project is using CommonJS modules.The current
exports
field of thepackage.json
looks like this:Bash Scripts
Compare Sizes
I've used the following bash script to compare the sizes of the components:
Clean
I've used the following bash script to remove the build folder and unnecessary files:
Table of Sizes
Checklist
Notes